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