}
});
final JTextField mac = new JTextField();
mac.setEnabled(isPhysical);
final JPanel portWrapper = new JPanel(new GridLayout(0, 2, 5, 5));
final PingMethod oldMethod = (isPhysical)?((PhysicalIF)i).getPingMethod():null;
int portNr = (isPhysical && oldMethod instanceof OpenSocket)?((OpenSocket)((PhysicalIF)i).getPingMethod()).getPort():0;
final JSpinner port = new JSpinner(new SpinnerNumberModel(portNr, 0, 65535, 1));
port.setEditor(new NumberEditor(port, "#####"));
port.setEnabled(isPhysical);
final JButton portScan = new JButton(new AbstractAction(Lang.get("port.scan")) {
@Override
public void actionPerformed(ActionEvent e) {
PortScanner ps = new PortScanner(owner, oldAddress);
port.setValue(ps.getPort());
}
});
portScan.setEnabled(isPhysical);
portWrapper.add(port);
portWrapper.add(portScan);
final JComboBox method = new JComboBox(new String[] {"Java Ping", "System Ping", "TCP Port"});
method.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean en = method.getSelectedIndex() == 2;
port.setEnabled(en);
portScan.setEnabled(en);
}
});
method.setEnabled(isPhysical);
if (oldMethod != null) method.setSelectedItem(oldMethod.toString());
if (isPhysical) {
gateway.setText(oldGateway);
mac.setText(((PhysicalIF)i).getMacAddress());
}
final JCheckBox addressCheckbox = new JCheckBox(Lang.get("interface.address"));