I would like to create JOptionPaneone that allows the user to select the IP address and port to connect. It should be structured as such,
JOptionPane
IP Address: [text box here]Port: [text box here]Cancel OK
IP Address: [text box here]
Port: [text box here]
Cancel OK
Labels should be left aligned, and text boxes should also be left aligned. I can't model the storyboard here, but basically the text fields should not be offset, even if there is a space between the labels and the text fields.
Each pair of labels and text fields should be on separate lines, and the Cancel buttons OK should be aligned to the right under the text fields.
Is there any way to do this in code?
. , .
, , , , :
labels.add(new JLabel("User Name", SwingConstants.RIGHT));
:
labels.add(new JLabel("User Name"));
, GridLayout WEST CENTER BorderLayout.
GridLayout
WEST
CENTER
BorderLayout
, , MigLayout J2SE, BoxLayout GroupLayout.
MigLayout
BoxLayout
GroupLayout
GroupLayout , , CENTER ( , , 2 ). , , .
(jdialog) JOptionPane.showInputDialog, . :
http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html