Search in sources :

Example 21 with JMenuBar

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));
}
Also used : PrintSwitchListAction(jmri.jmrit.operations.locations.tools.PrintSwitchListAction) Dimension(java.awt.Dimension) JMenuItem(javax.swing.JMenuItem) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

Example 22 with JMenuBar

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));
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagLayout(java.awt.GridBagLayout) ButtonGroup(javax.swing.ButtonGroup) BoxLayout(javax.swing.BoxLayout) Dimension(java.awt.Dimension) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

Example 23 with JMenuBar

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));
}
Also used : ShowCarsInTrainAction(jmri.jmrit.operations.trains.tools.ShowCarsInTrainAction) Dimension(java.awt.Dimension) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

Example 24 with JMenuBar

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) OperationsFrame(jmri.jmrit.operations.OperationsFrame) Frame(java.awt.Frame) GridBagLayout(java.awt.GridBagLayout) BoxLayout(javax.swing.BoxLayout) Dimension(java.awt.Dimension) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

Example 25 with JMenuBar

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);
}
Also used : JMenuBar(javax.swing.JMenuBar)

Aggregations

JMenuBar (javax.swing.JMenuBar)119 JMenu (javax.swing.JMenu)83 JMenuItem (javax.swing.JMenuItem)45 ActionEvent (java.awt.event.ActionEvent)36 ActionListener (java.awt.event.ActionListener)30 JPanel (javax.swing.JPanel)28 BoxLayout (javax.swing.BoxLayout)25 Dimension (java.awt.Dimension)23 JFrame (javax.swing.JFrame)17 JScrollPane (javax.swing.JScrollPane)15 JLabel (javax.swing.JLabel)14 JButton (javax.swing.JButton)13 JmriJFrame (jmri.util.JmriJFrame)12 GridBagLayout (java.awt.GridBagLayout)11 BorderLayout (java.awt.BorderLayout)10 JSeparator (javax.swing.JSeparator)10 AbstractAction (javax.swing.AbstractAction)9 FlowLayout (java.awt.FlowLayout)6 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)6 JPopupMenu (javax.swing.JPopupMenu)6