use of javax.swing.JMenuBar in project JMRI by JMRI.
the class YardmasterFrame method initComponents.
private void initComponents(Location location) {
super.initComponents();
if (location != null) {
// build menu
JMenuBar menuBar = new JMenuBar();
JMenu toolMenu = new JMenu(Bundle.getMessage("MenuTools"));
toolMenu.add(new YardmasterByTrackAction(location));
JMenuItem print = toolMenu.add(new PrintSwitchListAction(Bundle.getMessage("MenuItemPrint"), location, false));
JMenuItem preview = toolMenu.add(new PrintSwitchListAction(Bundle.getMessage("MenuItemPreview"), location, true));
menuBar.add(toolMenu);
setJMenuBar(menuBar);
// add tool tip if in consolidation mode: "Disabled when switch list is in consolidation mode"
if (!Setup.isSwitchListRealTime()) {
print.setToolTipText(Bundle.getMessage("TipDisabled"));
preview.setToolTipText(Bundle.getMessage("TipDisabled"));
}
setTitle(Bundle.getMessage("Yardmaster") + " (" + location.getName() + ")");
}
// NOI18N
addHelpMenu("package.jmri.jmrit.operations.Operations_Locations", true);
initMinimumSize(new Dimension(Control.panelWidth500, Control.panelHeight500));
}
use of javax.swing.JMenuBar in project JMRI by JMRI.
the class RouteEditFrame method initComponents.
public void initComponents(Route route) {
_route = route;
String routeName = null;
// load managers
routeManager = RouteManager.instance();
// Set up the jtable in a Scroll Pane..
routePane = new JScrollPane(routeTable);
routePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
routePane.setBorder(BorderFactory.createTitledBorder(""));
routeModel.initTable(this, routeTable, _route);
if (_route != null) {
routeName = _route.getName();
routeNameTextField.setText(routeName);
commentTextField.setText(_route.getComment());
enableButtons(true);
} else {
setTitle(Bundle.getMessage("TitleRouteAdd"));
enableButtons(false);
}
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
// Set up the panels
JPanel p1 = new JPanel();
p1.setLayout(new BoxLayout(p1, BoxLayout.X_AXIS));
JScrollPane p1Pane = new JScrollPane(p1);
p1Pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
p1Pane.setMinimumSize(new Dimension(300, 3 * routeNameTextField.getPreferredSize().height));
p1Pane.setMaximumSize(new Dimension(2000, 200));
p1Pane.setBorder(BorderFactory.createTitledBorder(""));
// name panel
JPanel pName = new JPanel();
pName.setLayout(new GridBagLayout());
pName.setBorder(BorderFactory.createTitledBorder(Bundle.getMessage("Name")));
addItem(pName, routeNameTextField, 0, 0);
// comment panel
JPanel pComment = new JPanel();
pComment.setLayout(new GridBagLayout());
pComment.setBorder(BorderFactory.createTitledBorder(Bundle.getMessage("Comment")));
addItem(pComment, commentTextField, 0, 0);
p1.add(pName);
p1.add(pComment);
JPanel p2 = new JPanel();
p2.setLayout(new BoxLayout(p2, BoxLayout.X_AXIS));
JScrollPane p2Pane = new JScrollPane(p2);
p2Pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
p2Pane.setMinimumSize(new Dimension(300, 3 * routeNameTextField.getPreferredSize().height));
p2Pane.setMaximumSize(new Dimension(2000, 200));
p2Pane.setBorder(BorderFactory.createTitledBorder(""));
// location panel
JPanel pLoc = new JPanel();
pLoc.setLayout(new GridBagLayout());
pLoc.setBorder(BorderFactory.createTitledBorder(Bundle.getMessage("Location")));
addItem(pLoc, locationBox, 0, 1);
addItem(pLoc, addLocationButton, 1, 1);
addItem(pLoc, addLocAtTop, 2, 1);
addItem(pLoc, addLocAtMiddle, 3, 1);
addItem(pLoc, addLocAtBottom, 4, 1);
// Wait or Depart Time panel
JPanel pWait = new JPanel();
pWait.setLayout(new GridBagLayout());
pWait.setBorder(BorderFactory.createTitledBorder(Bundle.getMessage("Display")));
addItem(pWait, showWait, 0, 1);
addItem(pWait, showDepartTime, 1, 1);
p2.add(pLoc);
p2.add(pWait);
// row 12 buttons
JPanel pB = new JPanel();
pB.setLayout(new GridBagLayout());
JScrollPane pBPane = new JScrollPane(pB);
pBPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
pBPane.setMinimumSize(new Dimension(300, 3 * routeNameTextField.getPreferredSize().height));
pBPane.setMaximumSize(new Dimension(2000, 200));
pBPane.setBorder(BorderFactory.createTitledBorder(""));
addItem(pB, deleteRouteButton, 0, 0);
addItem(pB, addRouteButton, 1, 0);
addItem(pB, saveRouteButton, 3, 0);
getContentPane().add(p1Pane);
getContentPane().add(routePane);
getContentPane().add(p2Pane);
getContentPane().add(pBPane);
// setup buttons
addButtonAction(addLocationButton);
addButtonAction(deleteRouteButton);
addButtonAction(addRouteButton);
addButtonAction(saveRouteButton);
// setup radio buttons
ButtonGroup group = new ButtonGroup();
group.add(addLocAtTop);
group.add(addLocAtMiddle);
group.add(addLocAtBottom);
addLocAtBottom.setSelected(true);
// to clear table row sorting
addRadioButtonAction(addLocAtTop);
addRadioButtonAction(addLocAtMiddle);
// to clear table row sorting
addRadioButtonAction(addLocAtBottom);
ButtonGroup groupTime = new ButtonGroup();
groupTime.add(showWait);
groupTime.add(showDepartTime);
addRadioButtonAction(showWait);
addRadioButtonAction(showDepartTime);
setTimeWaitRadioButtons();
// build menu
JMenuBar menuBar = new JMenuBar();
JMenu toolMenu = new JMenu(Bundle.getMessage("MenuTools"));
toolMenu.add(new RouteCopyAction(Bundle.getMessage("MenuItemCopy"), routeName));
toolMenu.add(new SetTrainIconRouteAction(Bundle.getMessage("MenuSetTrainIconRoute"), routeName));
toolMenu.addSeparator();
toolMenu.add(new PrintRouteAction(Bundle.getMessage("MenuItemPrint"), false, _route));
toolMenu.add(new PrintRouteAction(Bundle.getMessage("MenuItemPreview"), true, _route));
menuBar.add(toolMenu);
setJMenuBar(menuBar);
// NOI18N
addHelpMenu("package.jmri.jmrit.operations.Operations_EditRoute", true);
// get notified if combo box gets modified
LocationManager.instance().addPropertyChangeListener(this);
// set frame size and route for display
initMinimumSize(new Dimension(Control.panelWidth700, Control.panelHeight400));
}
use of javax.swing.JMenuBar in project JMRI by JMRI.
the class TrainConductorFrame method initComponents.
private void initComponents(Train train) {
super.initComponents();
if (train != null) {
setTitle(Bundle.getMessage("TitleTrainConductor") + " (" + train.getName() + ")");
}
// build menu
JMenuBar menuBar = new JMenuBar();
if (train != null) {
JMenu toolMenu = new JMenu(Bundle.getMessage("MenuTools"));
toolMenu.add(new ShowCarsInTrainAction(Bundle.getMessage("MenuItemShowCarsInTrain"), train));
menuBar.add(toolMenu);
}
setJMenuBar(menuBar);
// NOI18N
addHelpMenu("package.jmri.jmrit.operations.Operations_Trains", true);
initMinimumSize(new Dimension(Control.panelWidth500, Control.panelHeight500));
}
use of javax.swing.JMenuBar in project JMRI by JMRI.
the class TrainsByCarTypeFrame method initComponents.
public void initComponents(String carType) {
// load managers
manager = TrainManager.instance();
// general GUI config
getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
// Set up the panels
JPanel pCarType = new JPanel();
pCarType.setLayout(new GridBagLayout());
pCarType.setBorder(BorderFactory.createTitledBorder(Bundle.getMessage("Type")));
addItem(pCarType, typeComboBox, 0, 0);
addItem(pCarType, copyCheckBox, 1, 0);
addItem(pCarType, textCarType, 2, 0);
typeComboBox.setSelectedItem(carType);
copyCheckBox.setToolTipText(Bundle.getMessage("TipCopyCarType"));
pTrains = new JPanel();
pTrains.setLayout(new GridBagLayout());
JScrollPane trainPane = new JScrollPane(pTrains);
trainPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
trainPane.setBorder(BorderFactory.createTitledBorder(Bundle.getMessage("Trains")));
updateTrains();
JPanel pButtons = new JPanel();
pButtons.setLayout(new GridBagLayout());
pButtons.setBorder(BorderFactory.createEtchedBorder());
addItem(pButtons, clearButton, 0, 0);
addItem(pButtons, setButton, 1, 0);
addItem(pButtons, saveButton, 2, 0);
getContentPane().add(pCarType);
getContentPane().add(trainPane);
getContentPane().add(pButtons);
// setup combo box
addComboBoxAction(typeComboBox);
// setup buttons
addButtonAction(setButton);
addButtonAction(clearButton);
addButtonAction(saveButton);
// setup checkbox
addCheckBoxAction(copyCheckBox);
manager.addPropertyChangeListener(this);
CarTypes.instance().addPropertyChangeListener(this);
// build menu
JMenuBar menuBar = new JMenuBar();
JMenu toolMenu = new JMenu(Bundle.getMessage("MenuTools"));
toolMenu.add(new PrintTrainsByCarTypesAction(Bundle.getMessage("MenuItemPrintByType"), new Frame(), false, this));
toolMenu.add(new PrintTrainsByCarTypesAction(Bundle.getMessage("MenuItemPreviewByType"), new Frame(), true, this));
menuBar.add(toolMenu);
setJMenuBar(menuBar);
// NOI18N
addHelpMenu("package.jmri.jmrit.operations.Operations_ModifyTrainsByCarType", true);
setPreferredSize(null);
pack();
setMinimumSize(new Dimension(Control.panelWidth300, Control.panelHeight250));
setTitle(Bundle.getMessage("TitleModifyTrains"));
setVisible(true);
}
use of javax.swing.JMenuBar in project JMRI by JMRI.
the class PickFrame method makeMenus.
private void makeMenus() {
JMenuBar menuBar = new JMenuBar();
//JMenu fileMenu = new JMenu(rb.getString("MenuFile"));
//fileMenu.add(new jmri.configurexml.SaveMenu());
//menuBar.add(fileMenu);
setJMenuBar(menuBar);
addHelpMenu("package.jmri.jmrit.picker.PickTables", true);
}
Aggregations