use of javax.swing.BoxLayout in project JMRI by JMRI.
the class DefaultUserMessagePreferences method showMessage.
private void showMessage(String title, String message, final String strClass, final String item, final boolean sessionOnly, final boolean alwaysRemember, int type) {
final UserPreferencesManager p;
p = jmri.InstanceManager.getDefault(jmri.UserPreferencesManager.class);
final String preference = strClass + "." + item;
if (p.getSessionPreferenceState(preference)) {
return;
}
if (!p.getPreferenceState(strClass, item)) {
JPanel container = new JPanel();
container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
container.add(new JLabel(message));
final JCheckBox rememberSession = new JCheckBox(Bundle.getMessage("SkipMessageSession"));
//I18N in ManagersBundle.properties
if (sessionOnly) {
rememberSession.setFont(rememberSession.getFont().deriveFont(10f));
container.add(rememberSession);
}
final JCheckBox remember = new JCheckBox(Bundle.getMessage("SkipMessageFuture"));
//I18N in ManagersBundle.properties
if (alwaysRemember) {
remember.setFont(remember.getFont().deriveFont(10f));
container.add(remember);
}
// center over parent component
JOptionPane.showMessageDialog(// center over parent component
null, container, title, type);
if (remember.isSelected()) {
p.setPreferenceState(strClass, item, true);
}
if (rememberSession.isSelected()) {
p.setSessionPreferenceState(preference, true);
}
}
}
use of javax.swing.BoxLayout in project JMRI by JMRI.
the class AboutDialog method infoPane.
protected JPanel infoPane() {
JPanel pane1 = new JPanel();
pane1.setLayout(new BoxLayout(pane1, BoxLayout.Y_AXIS));
log.debug("start labels");
// add listener for Com port updates
for (ConnectionConfig conn : InstanceManager.getDefault(ConnectionConfigManager.class)) {
if (!conn.getDisabled()) {
pane1.add(new ConnectionLabel(conn));
}
}
pane1.add(Box.createRigidArea(new Dimension(0, 15)));
pane1.add(new JLabel(Bundle.getMessage("DefaultVersionCredit", Version.name())));
pane1.add(new JLabel(Version.getCopyright()));
pane1.add(new JLabel(Bundle.getMessage("JavaVersionCredit", System.getProperty("java.version", "<unknown>"), Locale.getDefault().toString())));
pane1.setAlignmentX(Component.CENTER_ALIGNMENT);
return pane1;
}
use of javax.swing.BoxLayout in project JMRI by JMRI.
the class AboutDialog method namePane.
protected JPanel namePane() {
String logo = Application.getLogo();
JPanel pane = new JPanel();
pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
if (log.isDebugEnabled()) {
log.debug("Fetch main logo: {} ", logo, getToolkit().getImage(FileUtil.findURL(logo, FileUtil.Location.INSTALLED)));
}
addCenteredComponent(new JLabel(new ImageIcon(getToolkit().getImage(FileUtil.findURL(logo, FileUtil.Location.INSTALLED)), "JMRI logo"), JLabel.CENTER), pane);
pane.add(Box.createRigidArea(new Dimension(0, 15)));
String name = Application.getApplicationName();
name = checkCopyright(name);
JLabel appName = new JLabel(name, JLabel.CENTER);
appName.setFont(pane.getFont().deriveFont(Font.BOLD, pane.getFont().getSize() * 1.2f));
addCenteredComponent(appName, pane);
addCenteredComponent(new JLabel(Application.getURL(), JLabel.CENTER), pane);
pane.add(Box.createRigidArea(new Dimension(0, 15)));
pane.setAlignmentX(Component.CENTER_ALIGNMENT);
return pane;
}
use of javax.swing.BoxLayout in project JMRI by JMRI.
the class ThreePaneTLRWindow method configureFrame.
protected void configureFrame() {
// TODO figure out what WI is used here
rightTopWI = new jmri.util.swing.sdi.JmriJFrameInterface();
//rightTop.setBorder(BorderFactory.createLineBorder(Color.black));
top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS));
right.setLayout(new FlowLayout());
left.setLayout(new FlowLayout());
leftRightSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right);
leftRightSplitPane.setOneTouchExpandable(true);
// emphasize right part
leftRightSplitPane.setResizeWeight(0.0);
upDownSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, leftRightSplitPane);
upDownSplitPane.setOneTouchExpandable(true);
// emphasize top part
upDownSplitPane.setResizeWeight(1.0);
add(upDownSplitPane, BorderLayout.CENTER);
}
use of javax.swing.BoxLayout in project JMRI by JMRI.
the class RpsTrackingPanelTest method testShow.
@Test
public void testShow() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
new Engine() {
void reset() {
_instance = null;
}
}.reset();
Engine.instance().setMaxReceiverNumber(2);
Engine.instance().setReceiver(1, new Receiver(new Point3d(12., 12., 0.)));
Engine.instance().setReceiver(2, new Receiver(new Point3d(13., 13., 0.)));
JmriJFrame f = new JmriJFrame("Test Tracking Panel");
f.getContentPane().setLayout(new BoxLayout(f.getContentPane(), BoxLayout.Y_AXIS));
RpsTrackingPanel p = new RpsTrackingPanel();
p.setSize(400, 400);
p.setOrigin(0, 0);
p.setCoordMax(30., 30.);
f.getContentPane().add(p);
f.pack();
// add some regions to probe corners
Region r = new Region("(4,4,0);(10,16,0);(18,10,0);(4,4,0)");
Model.instance().addRegion(r);
r = new Region("(30,15,0);(25,15,0);(25,20,0);(30,15,0)");
Model.instance().addRegion(r);
r = new Region("(15,30,0);(15,25,0);(20,25,0);(15,30,0)");
Model.instance().addRegion(r);
r = new Region("(25,25,0);(25,28,0);(30,30,1);(29,25,0);(25,25,0)");
Model.instance().addRegion(r);
// show overlap
r = new Region("(20,20,0);(22,20,0);(22,22,1);(20,22,0)");
Model.instance().addRegion(r);
r = new Region("(19,19,0);(21,19,0);(21,21,1);(19,21,0)");
Model.instance().addRegion(r);
// show panel
f.setSize(400, 400);
f.setVisible(true);
Reading loco = new Reading("21", null);
Measurement m = new Measurement(loco, 0.0, 0.0, 0.0, 0.133, 5, "source");
p.notify(m);
loco = new Reading("21", null);
m = new Measurement(loco, 5., 5., 0.0, 0.133, 5, "source");
p.notify(m);
loco = new Reading("21", null);
m = new Measurement(loco, 0., 5., 0.0, 0.133, 5, "source");
p.notify(m);
loco = new Reading("21", null);
m = new Measurement(loco, 5., 0., 0.0, 0.133, 5, "source");
p.notify(m);
// check separate locos
int NUM_LOCO = 64;
for (int i = 0; i < NUM_LOCO; i++) {
loco = new Reading("" + i, null);
m = new Measurement(loco, 6. + 1. * i, 0., 0.0, 0.133, 5, "source");
p.notify(m);
m = new Measurement(loco, 6. + 1. * i, 12., 0.0, 0.133, 5, "source");
p.notify(m);
}
Assert.assertNotNull("found frame", f);
f.dispose();
}
Aggregations