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();
}
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();
}
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();
}
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;
}
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;
}
Aggregations