use of jmri.jmrit.beantable.AddNewDevicePanel in project JMRI by JMRI.
the class SwitchboardEditor method connectNew.
/**
* Create new bean and connect it to this switch.
* Use type letter from switch label (S, T or L).
*/
protected void connectNew(String systemName) {
log.debug("Request new bean");
sysName.setText(systemName);
userName.setText("");
// provide etc.
if (addFrame == null) {
addFrame = new JmriJFrame(Bundle.getMessage("ConnectNewMenu", ""), false, true);
addFrame.addHelpMenu("package.jmri.jmrit.display.switchboardEditor.SwitchboardEditor", true);
addFrame.getContentPane().setLayout(new BoxLayout(addFrame.getContentPane(), BoxLayout.Y_AXIS));
ActionListener okListener = (ActionEvent ev) -> {
okAddPressed(ev);
};
ActionListener cancelListener = (ActionEvent ev) -> {
cancelAddPressed(ev);
};
AddNewDevicePanel switchConnect = new AddNewDevicePanel(sysName, userName, "ButtonOK", okListener, cancelListener);
// prevent user interference with switch label
switchConnect.setSystemNameFieldIneditable();
// activate OK button on Add new device pane
switchConnect.setOK();
addFrame.add(switchConnect);
}
addFrame.pack();
addFrame.setVisible(true);
}
Aggregations