Search in sources :

Example 36 with BoxLayout

use of javax.swing.BoxLayout in project JMRI by JMRI.

the class LocoDataPane method initComponents.

@Override
public void initComponents(jmri.jmrix.tams.TamsSystemConnectionMemo memo) {
    super.initComponents(memo);
    locoModel = new LocoDataModel(128, 16, memo);
    locoTable = new JTable(locoModel);
    locoTable.setRowSorter(new TableRowSorter<>(locoModel));
    locoScroll = new JScrollPane(locoTable);
    locoModel.configureTable(locoTable);
    // general GUI config
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    // install items in GUI
    JPanel pane1 = new JPanel();
    pane1.setLayout(new FlowLayout());
    pane1.add(new JLabel(rb.getString("Address")));
    pane1.add(addr);
    pane1.add(new JLabel(rb.getString("Name")));
    pane1.add(name);
    pane1.add(new JLabel(rb.getString("Steps")));
    pane1.add(speedBox);
    pane1.add(new JLabel(rb.getString("Format")));
    pane1.add(formatBox);
    pane1.add(addButton);
    // add listener object so checkboxes function
    addButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            addLoco();
        }
    });
    add(pane1);
    add(locoScroll);
    if (pane1.getMaximumSize().height > 0 && pane1.getMaximumSize().width > 0) {
        pane1.setMaximumSize(pane1.getPreferredSize());
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JTable(javax.swing.JTable) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel)

Example 37 with BoxLayout

use of javax.swing.BoxLayout in project JMRI by JMRI.

the class SerialPacketGenFrame method initComponents.

@Override
public void initComponents() throws Exception {
    // the following code sets the frame's initial state
    jLabel1.setText("Command:");
    jLabel1.setVisible(true);
    sendButton.setText("Send");
    sendButton.setVisible(true);
    sendButton.setToolTipText("Send packet");
    packetTextField.setText("");
    packetTextField.setToolTipText("Enter command as hexadecimal bytes separated by a space");
    packetTextField.setMaximumSize(new Dimension(packetTextField.getMaximumSize().width, packetTextField.getPreferredSize().height));
    setTitle("Send TMCC command");
    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
    getContentPane().add(jLabel1);
    getContentPane().add(packetTextField);
    getContentPane().add(sendButton);
    sendButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            sendButtonActionPerformed(e);
        }
    });
    getContentPane().add(new JSeparator(JSeparator.HORIZONTAL));
    // pack for display
    pack();
}
Also used : BoxLayout(javax.swing.BoxLayout) Dimension(java.awt.Dimension) JSeparator(javax.swing.JSeparator)

Example 38 with BoxLayout

use of javax.swing.BoxLayout in project JMRI by JMRI.

the class XpaPacketGenFrame method initComponents.

@Override
public void initComponents() throws Exception {
    // the following code sets the frame's initial state
    jLabel1.setText("Command:");
    jLabel1.setVisible(true);
    sendButton.setText("Send");
    sendButton.setVisible(true);
    sendButton.setToolTipText("Send packet");
    packetTextField.setText("");
    packetTextField.setToolTipText("Enter command as ASCII string (hex not yet available)");
    packetTextField.setMaximumSize(new Dimension(packetTextField.getMaximumSize().width, packetTextField.getPreferredSize().height));
    setTitle("Send Xpa+Modem command");
    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
    getContentPane().add(jLabel1);
    getContentPane().add(packetTextField);
    getContentPane().add(sendButton);
    sendButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            sendButtonActionPerformed(e);
        }
    });
    // pack for display
    pack();
}
Also used : BoxLayout(javax.swing.BoxLayout) Dimension(java.awt.Dimension)

Example 39 with BoxLayout

use of javax.swing.BoxLayout in project JMRI by JMRI.

the class XpaConfigureFrame method initComponents.

@Override
public void initComponents() {
    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
    // First set up the pane for address selection.
    JPanel pane0 = new JPanel();
    pane0.setLayout(new FlowLayout());
    pane0.add(new JLabel("XPressNet Address: "));
    pane0.add(addrBox);
    pane0.add(setAddr);
    pane0.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    getContentPane().add(pane0);
    // Next, set up the pane that determines what the zero 
    // button does
    JPanel pane1 = new JPanel();
    pane1.setLayout(new FlowLayout());
    pane1.add(new JLabel("Zero Button Causes: "));
    pane1.add(zeroEmergencyOff);
    pane1.add(zeroEmergencyStop);
    pane1.add(setZero);
    pane1.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    getContentPane().add(pane1);
    // add the pane that sets the momentary function durration
    JPanel pane2 = new JPanel();
    pane2.setLayout(new FlowLayout());
    pane2.add(new JLabel("Momentary Function Durration: "));
    pane2.add(functionBox);
    pane2.add(setFunction);
    pane2.setAlignmentX(java.awt.Component.CENTER_ALIGNMENT);
    getContentPane().add(pane2);
    // add the reset button.
    getContentPane().add(xpaReset);
    // Initialzie the components
    setAddr.setText("Set Address");
    setAddr.setVisible(true);
    setAddr.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            setAddrActionPerformed(e);
        }
    });
    // Initilize the Address Components
    addrBox.setVisible(true);
    addrBox.setToolTipText("Select the XpressNet address");
    for (int i = 0; i < validXNetAddresses.length; i++) {
        addrBox.addItem(validXNetAddresses[i]);
    }
    addrBox.setSelectedIndex(0);
    // Initilize the function buttons for the zero key 
    // settings.
    zeroEmergencyOff.setText("Emergency Off");
    zeroEmergencyOff.setSelected(true);
    zeroEmergencyOff.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            zeroEmergencyOffActionPerformed(e);
        }
    });
    zeroEmergencyStop.setText("Emergency Stop");
    zeroEmergencyStop.setSelected(false);
    zeroEmergencyStop.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            zeroEmergencyStopActionPerformed(e);
        }
    });
    setZero.setText("Set Zero Function");
    setZero.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            setZeroActionPerformed(e);
        }
    });
    // Initilize the Function durration components
    setFunction.setText("Set Durration");
    setFunction.setVisible(true);
    setFunction.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            setFunctionActionPerformed(e);
        }
    });
    functionBox.setVisible(true);
    functionBox.setToolTipText("Select the durration of momentary Functions");
    for (int i = 0; i < validTimes.length; i++) {
        functionBox.addItem(validTimes[i]);
    }
    functionBox.setSelectedIndex(0);
    // Initilize the reset button
    xpaReset.setText("Reset XPA");
    xpaReset.setVisible(true);
    xpaReset.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            xpaResetActionPerformed(e);
        }
    });
    // pack for display
    pack();
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel)

Example 40 with BoxLayout

use of javax.swing.BoxLayout in project JMRI by JMRI.

the class StatusPanel method initComponents.

@Override
public void initComponents(TamsSystemConnectionMemo memo) {
    super.initComponents(memo);
    //memo.getTrafficController().addTamsListener(this);
    tc = memo.getTrafficController();
    // Create GUI
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(appVersion);
    add(serVersion);
    // ask to be notified
    TamsMessage m = new TamsMessage("xV");
    tc.sendTamsMessage(m, this);
    sendButton = new JButton("Update");
    sendButton.setVisible(true);
    sendButton.setToolTipText("Request status update from TAMS System");
    add(sendButton);
    sendButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            sendButtonActionPerformed(e);
        }
    });
}
Also used : BoxLayout(javax.swing.BoxLayout) TamsMessage(jmri.jmrix.tams.TamsMessage) JButton(javax.swing.JButton)

Aggregations

BoxLayout (javax.swing.BoxLayout)593 JPanel (javax.swing.JPanel)510 JLabel (javax.swing.JLabel)301 Dimension (java.awt.Dimension)189 ActionEvent (java.awt.event.ActionEvent)179 JButton (javax.swing.JButton)173 ActionListener (java.awt.event.ActionListener)155 JScrollPane (javax.swing.JScrollPane)140 FlowLayout (java.awt.FlowLayout)130 JCheckBox (javax.swing.JCheckBox)74 BorderLayout (java.awt.BorderLayout)73 GridBagLayout (java.awt.GridBagLayout)66 ButtonGroup (javax.swing.ButtonGroup)58 JTable (javax.swing.JTable)53 JTextField (javax.swing.JTextField)53 Container (java.awt.Container)51 JmriJFrame (jmri.util.JmriJFrame)45 JComboBox (javax.swing.JComboBox)44 JSeparator (javax.swing.JSeparator)44 Box (javax.swing.Box)41