Search in sources :

Example 1 with AddNewDevicePanel

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);
}
Also used : ActionListener(java.awt.event.ActionListener) JmriJFrame(jmri.util.JmriJFrame) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) AddNewDevicePanel(jmri.jmrit.beantable.AddNewDevicePanel)

Aggregations

ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 BoxLayout (javax.swing.BoxLayout)1 AddNewDevicePanel (jmri.jmrit.beantable.AddNewDevicePanel)1 JmriJFrame (jmri.util.JmriJFrame)1