final JPanel pnlLocalPeer = new JPanel();
pnlLocalPeer
.setLayout(new BoxLayout(pnlLocalPeer, BoxLayout.PAGE_AXIS));
pnlLocalPeer.add(new JLabel("Select port where to start peer:"));
final JFormattedTextField localPort = new JFormattedTextField(
new NumberFormatter());
localPort.setValue(11111);
pnlLocalPeer.add(localPort);
final JPanel pnlMasterPeer = new JPanel();
pnlMasterPeer.setLayout(new BoxLayout(pnlMasterPeer,
BoxLayout.PAGE_AXIS));
final JCheckBox connectMaster = new JCheckBox(
"Should be connected with master peer?");
pnlMasterPeer.add(connectMaster);
final JPanel masterConfiguration = new JPanel();
masterConfiguration.setLayout(new BoxLayout(masterConfiguration,
BoxLayout.PAGE_AXIS));
masterConfiguration.setVisible(false);
pnlMasterPeer.add(masterConfiguration);
connectMaster.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent arg0) {
//show master-configuration only if is to be connected to master peer
masterConfiguration.setVisible(connectMaster.isSelected());
}
});
masterConfiguration
.add(new JLabel("Select master-port to connect to:"));
final JFormattedTextField masterPort = new JFormattedTextField(
new NumberFormatter());
masterPort.setValue(11111);
masterConfiguration.add(masterPort);
masterConfiguration.add(new JLabel(
"Select master-address/ip to connect to:"));
final JTextField masterAddress = new JTextField();