2
如何修復Gateway的標籤,這是唯一沒有顯示的標籤。其餘的都在展示。如何設置JTextField的標籤?
public TextLabelMirror() {
// DHCP
String[] petStrings = { "Static", "Auto" };
JPanel namePanel = new JPanel(new BorderLayout());
JLabel nameLabel = new JLabel("DHCP Mode: ");
nameLabel.setDisplayedMnemonic(KeyEvent.VK_N);
final JComboBox nameTextField = new JComboBox(petStrings);
nameLabel.setLabelFor(nameTextField);
namePanel.add(nameLabel, BorderLayout.WEST);
namePanel.add(nameTextField, BorderLayout.CENTER);
// IP - Address
JPanel namePanel0 = new JPanel(new BorderLayout());
JLabel nameLabel0 = new JLabel("IP: ");
nameLabel0.setDisplayedMnemonic(KeyEvent.VK_N);
final JTextField nameTextField0 = new JTextField(20);
nameLabel0.setLabelFor(nameTextField0);
namePanel0.add(nameLabel0, BorderLayout.WEST);
namePanel0.add(nameTextField0, BorderLayout.CENTER);
// NetMask
JPanel namePanel1 = new JPanel(new BorderLayout());
JLabel nameLabel1 = new JLabel("Netmask: ");
nameLabel1.setDisplayedMnemonic(KeyEvent.VK_N);
final JTextField nameTextField1 = new JTextField(20);
nameLabel1.setLabelFor(nameTextField1);
namePanel1.add(nameLabel1, BorderLayout.WEST);
namePanel1.add(nameTextField1, BorderLayout.CENTER);
// Gateway
JPanel namePanel2 = new JPanel(new BorderLayout());
JLabel nameLabel2 = new JLabel("Gateway: ");
nameLabel2.setDisplayedMnemonic(KeyEvent.VK_N);
final JTextField nameTextField2 = new JTextField(20);
nameLabel2.setLabelFor(nameTextField2);
namePanel2.add(nameLabel2, BorderLayout.WEST);
namePanel2.add(nameTextField2, BorderLayout.WEST);
// Save now
JPanel namePanel3 = new JPanel(new BorderLayout());
final JButton nameTextField3 = new JButton("Save");
namePanel3.add(nameTextField3, BorderLayout.CENTER);
....
}