use of javax.swing.JSeparator in project JMRI by JMRI.
the class PaneProgFrame method setProgrammingGui.
void setProgrammingGui(JPanel pane) {
// see if programming mode is available
modePane = getModePane();
if (modePane != null) {
// if so, configure programming part of GUI
JPanel bottom = new JPanel();
bottom.setLayout(new BoxLayout(bottom, BoxLayout.Y_AXIS));
// add buttons
JPanel bottomButtons = new JPanel();
bottomButtons.setLayout(new BoxLayout(bottomButtons, BoxLayout.X_AXIS));
bottomButtons.add(readChangesButton);
bottomButtons.add(writeChangesButton);
bottomButtons.add(readAllButton);
bottomButtons.add(writeAllButton);
bottom.add(bottomButtons);
// add programming mode
bottom.add(new JSeparator(javax.swing.SwingConstants.HORIZONTAL));
JPanel temp = new JPanel();
bottom.add(temp);
temp.add(modePane);
// add programming status message
bottom.add(new JSeparator(javax.swing.SwingConstants.HORIZONTAL));
progStatus.setAlignmentX(JLabel.CENTER_ALIGNMENT);
bottom.add(progStatus);
pane.add(bottom, BorderLayout.SOUTH);
}
}
use of javax.swing.JSeparator in project JMRI by JMRI.
the class DuplexGroupInfoPanel method initComponents.
@Override
public void initComponents() throws Exception {
// uses swing operations
JLabel swingTempLabel;
try {
minWindowWidth = Integer.parseInt(rb.getString("MinimumWidthForWindow"), 10);
} catch (Exception e) {
minWindowWidth = DEFAULT_WINDOW_WIDTH;
}
// assume 0 UR92 devices available
numUr92 = 0;
swingStatusValueLabel = new JLabel();
//this string is used as a reference to a .properties file entry; internationalization is handled there.
swingStatusValueLabel.setName("ProcessingInitialStatusMessage");
swingStatusValueLabel.setText(convertToHtml(swingStatusValueLabel.getName(), minWindowWidth));
swingNameValueField.setText(rb.getString("ValueUnknownGroupName"));
swingNameValueField.setToolTipText(rb.getString("ToolTipGroupName"));
swingNameValueField.setLastQueriedValue(rb.getString("ValueUnknownGroupName"));
swingChannelValueField.setText(rb.getString("ValueUnknownGroupChannel"));
swingChannelValueField.setToolTipText(rb.getString("ToolTipGroupChannel"));
swingChannelValueField.setLastQueriedValue(rb.getString("ValueUnknownGroupChannel"));
swingPasswordValueField.setText(rb.getString("ValueUnknownGroupPassword"));
swingPasswordValueField.setToolTipText(rb.getString("ToolTipGroupPassword"));
swingPasswordValueField.setLastQueriedValue(rb.getString("ValueUnknownGroupPassword"));
swingIdValueField.setText(rb.getString("ValueUnknownGroupID"));
swingIdValueField.setToolTipText(rb.getString("ToolTipGroupID"));
swingIdValueField.setLastQueriedValue(rb.getString("ValueUnknownGroupID"));
// Want to force space in the GUI for N lines of status, where N comes
// from a value in the DuplexGroup.properties file;
// assume 2 if not able to parse the variable from the .properties file.
int numLinesForStatus = 2;
try {
numLinesForStatus = Integer.parseInt(rb.getString("FixedLinesForStatus"));
} catch (Exception e) {
numLinesForStatus = 2;
}
swingStatusValueLabel.setPreferredSize(new java.awt.Dimension(minWindowWidth, numLinesForStatus * (int) swingStatusValueLabel.getMaximumSize().getHeight()));
swingReadButton = new JButton(rb.getString("ButtonRead"));
swingSetButton = new JButton(rb.getString("ButtonSet"));
// need to override the default layout of FlowLayout (horizontal layout)
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
swingReadButton.hasFocus();
JPanel swingTempPanel = new JPanel();
swingTempPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 5, 3));
swingTempPanel.add(swingTempLabel = new JLabel(rb.getString("LabelDuplexName")));
swingTempPanel.add(swingNameValueField);
// for "assistive technology" per JLabel on-line documentation
swingTempLabel.setLabelFor(swingNameValueField);
add(swingTempPanel);
swingTempPanel = new JPanel();
swingTempPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 5, 3));
swingTempPanel.add(swingTempLabel = new JLabel(rb.getString("LabelDuplexChannel")));
swingTempPanel.add(swingChannelValueField);
// for "assistive technology" per JLabel on-line documentation
swingTempLabel.setLabelFor(swingChannelValueField);
add(swingTempPanel);
swingTempPanel = new JPanel();
swingTempPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 5, 3));
swingTempPanel.add(swingTempLabel = new JLabel(rb.getString("LabelDuplexPassword")));
swingTempPanel.add(swingPasswordValueField);
// for "assistive technology" per JLabel on-line documentation
swingTempLabel.setLabelFor(swingPasswordValueField);
add(swingTempPanel);
swingTempPanel = new JPanel();
swingTempPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 5, 3));
swingTempPanel.add(swingTempLabel = new JLabel(rb.getString("LabelDuplexGroupID")));
swingTempPanel.add(swingIdValueField);
// for "assistive technology" per JLabel on-line documentation
swingTempLabel.setLabelFor(swingIdValueField);
add(swingTempPanel);
swingTempPanel = new JPanel();
swingTempPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 5, 3));
swingTempPanel.add(swingNumUr92Label = new JLabel(" "));
updateDisplayOfUr92Count();
add(swingTempPanel);
swingTempPanel = new JPanel();
swingTempPanel.setLayout(new java.awt.FlowLayout());
swingTempPanel.add(swingReadButton);
swingTempPanel.add(swingSetButton);
add(swingTempPanel);
add(new JSeparator());
swingTempPanel = new JPanel();
swingTempPanel.setLayout(new java.awt.FlowLayout());
swingTempPanel.add(swingStatusValueLabel);
add(swingTempPanel);
swingSetButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
setButtonActionPerformed();
}
});
swingReadButton.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
scanButtonActionPerformed();
}
});
}
use of javax.swing.JSeparator in project JMRI by JMRI.
the class RpsTrackingFrame method initComponents.
@Override
public void initComponents() {
addHelpMenu("package.jmri.jmrix.rps.trackingpanel.RpsTrackingFrame", true);
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
panel = new RpsTrackingPanel();
// add controls; first, clear button
JPanel controls = new JPanel();
controls.setLayout(new BoxLayout(controls, BoxLayout.Y_AXIS));
JPanel line = new JPanel();
line.setLayout(new FlowLayout());
clearButton = new JButton("Clear");
clearButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
clearButtonChanged();
}
});
line.add(clearButton);
// button for handling errors
showErrButton = new JCheckBox("Show error points");
showErrButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
showErrButtonChanged();
}
});
line.add(showErrButton);
// button for showing receivers
showRecButton = new JCheckBox("Show receivers");
showRecButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
showRecButtonChanged();
}
});
showRecButton.setSelected(true);
showRecButtonChanged();
line.add(showRecButton);
// button for showing regions
showRegButton = new JCheckBox("Show regions");
showRegButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
showRegButtonChanged();
}
});
showRegButton.setSelected(true);
showRegButtonChanged();
line.add(showRegButton);
controls.add(line);
// configure alignment control
scale = new RpsTrackingControlPane(panel);
controls.add(scale);
controls.add(new JSeparator());
panel.setSize(440, 240);
panel.setPreferredSize(new Dimension(440, 240));
// lower left X, Y, then upper right
scale.set(-10., -10., 50., 50.);
scale.update();
// combine
//JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, controls, panel);
//getContentPane().add(split);
getContentPane().add(panel);
getContentPane().add(new JSeparator());
getContentPane().add(controls);
panel.repaint();
pack();
// fix size of controls
Dimension d = controls.getSize();
controls.setMinimumSize(d);
controls.setPreferredSize(d);
controls.setMaximumSize(d);
}
use of javax.swing.JSeparator in project JMRI by JMRI.
the class AlignmentPanel method initComponents.
void initComponents() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
lines = new Line[NREADINGS];
// add alignment lines
for (int i = 0; i < NREADINGS; i++) {
lines[i] = new Line();
add(lines[i]);
}
// add bottom info
JPanel p;
p = new JPanel();
algorithm = Algorithms.algorithmBox();
p.add(algorithm);
p.add(new JLabel("Vs: "));
p.add(vs);
vs.setText("0.01345");
p.add(calc);
calc.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
calculate();
}
});
add(p);
p = new JPanel();
p.add(new JLabel("X:"));
p.add(x1l);
p.add(x2l);
p.add(x3l);
p.add(x4l);
add(p);
p = new JPanel();
p.add(new JLabel("Y:"));
p.add(y1l);
p.add(y2l);
p.add(y3l);
p.add(y4l);
add(p);
p = new JPanel();
p.add(new JLabel("Z:"));
p.add(z1l);
p.add(z2l);
p.add(z3l);
p.add(z4l);
add(p);
p = new JPanel();
p.add(new JLabel("S:"));
p.add(stat1);
p.add(stat2);
p.add(stat3);
p.add(stat4);
add(p);
// file load, store
p = new JPanel();
JButton b1;
b1 = new JButton("Store...");
b1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
store();
}
});
p.add(b1);
b1 = new JButton("Load...");
b1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
load();
}
});
p.add(b1);
add(new JSeparator());
add(p);
// load for debug
dummy3();
}
use of javax.swing.JSeparator in project cytoscape-api by cytoscape.
the class AbstractGravityTrackerTest method testAddMenuSeparator.
@Test
public void testAddMenuSeparator() {
final JMenu menu1 = new JMenu();
gravityTracker.addMenu(menu1, 10.0);
final JMenu menu2 = new JMenu();
gravityTracker.addMenu(menu2, 5.0);
gravityTracker.addMenuSeparator(7.5);
final Component someMenu = gravityTracker.getMenu();
if (someMenu instanceof JMenu) {
final JMenu menu = (JMenu) someMenu;
assertEquals(menu2, menu.getMenuComponent(0));
assertTrue(menu.getMenuComponent(1) instanceof JSeparator);
assertEquals(menu1, menu.getMenuComponent(2));
} else {
final JPopupMenu menu = (JPopupMenu) someMenu;
assertEquals(menu2, menu.getComponent(0));
assertTrue(menu.getComponent(1) instanceof JSeparator);
assertEquals(menu1, menu.getComponent(2));
}
}
Aggregations