Search in sources :

Example 96 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 Oak Tree serial 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));
    // add poll message buttons
    JPanel pane3 = new JPanel();
    pane3.setLayout(new FlowLayout());
    pane3.add(new JLabel("Address:"));
    pane3.add(uaAddrField);
    pane3.add(pollButton);
    uaAddrField.setText("0");
    uaAddrField.setToolTipText("Enter node address (decimal integer)");
    getContentPane().add(pane3);
    pollButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            pollButtonActionPerformed(e);
        }
    });
    pollButton.setToolTipText("Send poll request");
    // pack for display
    pack();
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JSeparator(javax.swing.JSeparator)

Example 97 with BoxLayout

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

the class PacketTableFrame method initComponents.

@Override
public void initComponents() {
    table = new JTable(model);
    table.setRowSorter(new TableRowSorter<>(model));
    scroll = new JScrollPane(table);
    model.configureTable(table);
    // general GUI config
    setTitle("Packet Monitor");
    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
    getContentPane().add(scroll);
    JPanel p1 = new JPanel();
    JButton b = new JButton(rb.getString("ButtonClear"));
    b.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            model.reset();
        }
    });
    p1.add(b);
    getContentPane().add(p1);
    pack();
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTable(javax.swing.JTable) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton)

Example 98 with BoxLayout

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

the class PacketGenFrame 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 hex string");
    packetTextField.setMaximumSize(new Dimension(packetTextField.getMaximumSize().width, packetTextField.getPreferredSize().height));
    setTitle("Send QSI 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 99 with BoxLayout

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

the class SignalPro method statusPanel.

@Override
protected JPanel statusPanel() {
    JPanel j = new JPanel();
    j.setLayout(new BoxLayout(j, BoxLayout.Y_AXIS));
    j.add(super.statusPanel());
    // Buttons
    Action quit = new AbstractAction(Bundle.getMessage("MenuItemQuit")) {

        @Override
        public void actionPerformed(ActionEvent e) {
            Apps.handleQuit();
        }
    };
    JPanel p3 = new JPanel();
    p3.setLayout(new java.awt.FlowLayout());
    JButton h1 = new JButton(Bundle.getMessage("ButtonHelp"));
    jmri.util.HelpUtil.addHelpToComponent(h1, "html.apps.SignalPro.SignalPro");
    h1.setAlignmentX(JLabel.CENTER_ALIGNMENT);
    p3.add(h1);
    JButton q1 = new JButton(Bundle.getMessage("ButtonQuit"));
    q1.addActionListener(quit);
    q1.setAlignmentX(JLabel.CENTER_ALIGNMENT);
    p3.add(q1);
    j.add(p3);
    return j;
}
Also used : JPanel(javax.swing.JPanel) Action(javax.swing.Action) AbstractAction(javax.swing.AbstractAction) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) AbstractAction(javax.swing.AbstractAction)

Example 100 with BoxLayout

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

the class AbstractActionModelFactory method getDialogMessage.

private JPanel getDialogMessage(JList<String> actions, JComboBox<String> connections) {
    // NOI18N
    JLabel connectionsLabel = new JLabel(Bundle.getMessage("AbstractActionModelFactory.getDialogMessage.connectionsLabel", JLabel.LEADING));
    actions.getSelectionModel().addListSelectionListener((ListSelectionEvent e) -> {
        if (!e.getValueIsAdjusting()) {
            connections.removeAllItems();
            connections.setEnabled(false);
            connectionsLabel.setEnabled(false);
            String name = actions.getSelectedValue();
            if (name != null) {
                String className = StartupActionModelUtil.getDefault().getClassName(name);
                if (className != null && StartupActionModelUtil.getDefault().isSystemConnectionAction(className)) {
                    try {
                        Action action = (Action) Class.forName(className).newInstance();
                        if (SystemConnectionAction.class.isAssignableFrom(action.getClass())) {
                            ((SystemConnectionAction) action).getSystemConnectionMemoClasses().stream().forEach((clazz) -> {
                                InstanceManager.getList(SystemConnectionMemo.class).stream().forEach((memo) -> {
                                    if (clazz.isAssignableFrom(memo.getClass())) {
                                        connections.addItem(memo.getUserName());
                                        connections.setEnabled(true);
                                        connectionsLabel.setEnabled(true);
                                    }
                                });
                            });
                        }
                    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
                        log.error("Unable to create Action", ex);
                    }
                }
            }
        }
    });
    connections.setEnabled(false);
    connectionsLabel.setEnabled(false);
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    panel.add(new JLabel(this.getEditModelMessage(), JLabel.LEADING));
    panel.add(new JScrollPane(actions));
    panel.add(connectionsLabel);
    panel.add(connections);
    return panel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) SystemConnectionAction(jmri.jmrix.swing.SystemConnectionAction) Action(javax.swing.Action) BoxLayout(javax.swing.BoxLayout) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JLabel(javax.swing.JLabel) SystemConnectionAction(jmri.jmrix.swing.SystemConnectionAction)

Aggregations

BoxLayout (javax.swing.BoxLayout)496 JPanel (javax.swing.JPanel)423 JLabel (javax.swing.JLabel)252 ActionEvent (java.awt.event.ActionEvent)165 JButton (javax.swing.JButton)161 Dimension (java.awt.Dimension)143 ActionListener (java.awt.event.ActionListener)141 JScrollPane (javax.swing.JScrollPane)125 FlowLayout (java.awt.FlowLayout)123 BorderLayout (java.awt.BorderLayout)63 GridBagLayout (java.awt.GridBagLayout)57 ButtonGroup (javax.swing.ButtonGroup)49 Container (java.awt.Container)48 JTable (javax.swing.JTable)48 JCheckBox (javax.swing.JCheckBox)47 JmriJFrame (jmri.util.JmriJFrame)45 JSeparator (javax.swing.JSeparator)44 JTextField (javax.swing.JTextField)43 JRadioButton (javax.swing.JRadioButton)30 JComboBox (javax.swing.JComboBox)28