Search in sources :

Example 96 with JMenuBar

use of javax.swing.JMenuBar in project JMRI by JMRI.

the class ConfigBaseStationFrame method addHelpMenu.

/**
     * Add a standard help menu, including window specific help item.
     *
     * @param ref    JHelp reference for the desired window-specific help page
     * @param direct true if the help menu goes directly to the help system,
     *               e.g. there are no items in the help menu
     *
     * WARNING: BORROWED FROM JmriJFrame.
     */
@Override
public void addHelpMenu(String ref, boolean direct) {
    // only works if no menu present?
    JMenuBar bar = getJMenuBar();
    if (bar == null) {
        bar = new JMenuBar();
    }
    // add Window menu
    // * GT 28-AUG-2008 Added window menu
    bar.add(new WindowMenu(this));
    // add Help menu
    jmri.util.HelpUtil.helpMenu(bar, ref, direct);
    setJMenuBar(bar);
}
Also used : WindowMenu(jmri.util.WindowMenu) JMenuBar(javax.swing.JMenuBar)

Example 97 with JMenuBar

use of javax.swing.JMenuBar in project JMRI by JMRI.

the class ConfigBaseStationFrame method buildMenu.

private void buildMenu() {
    JMenu fileMenu = new JMenu(Bundle.getMessage("MenuFile"));
    //fileMenu.add(new LoadVSDFileAction(Bundle.getMessage("MenuItemLoadVSDFile")));
    //fileMenu.add(new StoreXmlVSDecoderAction(Bundle.getMessage("MenuItemSaveProfile")));
    //fileMenu.add(new LoadXmlVSDecoderAction(Bundle.getMessage("MenuItemLoadProfile")));
    JMenu editMenu = new JMenu(Bundle.getMessage("MenuEdit"));
    //editMenu.add(new VSDPreferencesAction(Bundle.getMessage("MenuItemEditPreferences")));
    //fileMenu.getItem(1).setEnabled(false); // disable XML store
    //fileMenu.getItem(2).setEnabled(false); // disable XML load
    menuList = new ArrayList<JMenu>(3);
    menuList.add(fileMenu);
    menuList.add(editMenu);
    this.setJMenuBar(new JMenuBar());
    this.getJMenuBar().add(fileMenu);
    this.getJMenuBar().add(editMenu);
//this.addHelpMenu("package.jmri.jmrit.vsdecoder.swing.ManageLocationsFrame", true); // NOI18N
}
Also used : JMenu(javax.swing.JMenu) JMenuBar(javax.swing.JMenuBar)

Example 98 with JMenuBar

use of javax.swing.JMenuBar in project JMRI by JMRI.

the class DebuggerFrame method initComponents.

@Override
public void initComponents() {
    nf = java.text.NumberFormat.getInstance();
    nf.setMinimumFractionDigits(1);
    nf.setMaximumFractionDigits(1);
    nf.setGroupingUsed(false);
    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
    // add panes in the middle
    JPanel p, p1;
    // Time inputs
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(new JLabel("Time measurements: "));
    timep.initComponents();
    JScrollPane sc = new JScrollPane(timep);
    p.add(sc);
    // add id field at bottom
    JPanel p5 = new JPanel();
    p5.setLayout(new FlowLayout());
    p5.add(new JLabel("Id: "));
    p5.add(id);
    p.add(p5);
    getContentPane().add(p);
    getContentPane().add(new JSeparator());
    // x, y, z results
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(new JLabel("Results:"));
    p1 = new JPanel();
    p1.setLayout(new FlowLayout());
    p1.add(new JLabel("X:"));
    p1.add(x);
    p.add(p1);
    p1 = new JPanel();
    p1.setLayout(new FlowLayout());
    p1.add(new JLabel("Y:"));
    p1.add(y);
    p.add(p1);
    p1 = new JPanel();
    p1.setLayout(new FlowLayout());
    p1.add(new JLabel("Z:"));
    p1.add(z);
    p.add(p1);
    p1 = new JPanel();
    p1.setLayout(new FlowLayout());
    p1.add(new JLabel("Code:"));
    p1.add(code);
    p.add(p1);
    getContentPane().add(p);
    getContentPane().add(new JSeparator());
    // add controls at bottom
    p = new JPanel();
    mode = new JComboBox<String>(new String[] { "From time fields", "from X,Y,Z fields", "from time file", "from X,Y,Z file" });
    p.add(mode);
    p.setLayout(new FlowLayout());
    doButton = new JButton("Do Once");
    doButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            doOnce();
        }
    });
    p.add(doButton);
    getContentPane().add(p);
    // start working
    Distributor.instance().addReadingListener(this);
    Distributor.instance().addMeasurementListener(this);
    // add file menu
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);
    fileMenu.add(new jmri.jmrix.rps.swing.CsvExportAction("Export Readings as CSV..."));
    fileMenu.add(new jmri.jmrix.rps.swing.CsvExportMeasurementAction("Export Measurements as CSV..."));
    setJMenuBar(menuBar);
    // add help
    addHelpMenu("package.jmri.jmrix.rps.swing.debugger.DebuggerFrame", true);
    // prepare for display
    pack();
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JSeparator(javax.swing.JSeparator) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

Example 99 with JMenuBar

use of javax.swing.JMenuBar in project JMRI by JMRI.

the class ItemPalette method makeMenus.

private void makeMenus(Editor editor) {
    if (!jmri.util.ThreadingUtil.isGUIThread())
        log.error("Not on GUI thread", new Exception("traceback"));
    JMenuBar menuBar = new JMenuBar();
    JMenu findIcon = new JMenu(Bundle.getMessage("findIconMenu"));
    menuBar.add(findIcon);
    JMenuItem editItem = new JMenuItem(Bundle.getMessage("editIndexMenu"));
    editItem.addActionListener(new ActionListener() {

        Editor editor;

        @Override
        public void actionPerformed(ActionEvent e) {
            ImageIndexEditor ii = ImageIndexEditor.instance(editor);
            ii.pack();
            ii.setVisible(true);
        }

        ActionListener init(Editor ed) {
            editor = ed;
            return this;
        }
    }.init(editor));
    findIcon.add(editItem);
    findIcon.addSeparator();
    JMenuItem openItem = new JMenuItem(Bundle.getMessage("openDirMenu"));
    openItem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            DirectorySearcher.instance().openDirectory();
        }
    });
    findIcon.add(openItem);
    JMenuItem searchItem = new JMenuItem(Bundle.getMessage("searchFSMenu"));
    searchItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            jmri.jmrit.catalog.DirectorySearcher.instance().searchFS();
        }
    });
    findIcon.add(searchItem);
    setJMenuBar(menuBar);
    addHelpMenu("package.jmri.jmrit.display.ItemPalette", true);
}
Also used : ActionListener(java.awt.event.ActionListener) ImageIndexEditor(jmri.jmrit.catalog.ImageIndexEditor) ActionEvent(java.awt.event.ActionEvent) JMenuItem(javax.swing.JMenuItem) Editor(jmri.jmrit.display.Editor) ImageIndexEditor(jmri.jmrit.catalog.ImageIndexEditor) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

Example 100 with JMenuBar

use of javax.swing.JMenuBar in project JMRI by JMRI.

the class WarrantFrame method makeMenus.

private void makeMenus() {
    setTitle(Bundle.getMessage("TitleWarrant", _warrant.getDisplayName()));
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu(Bundle.getMessage("MenuFile"));
    fileMenu.add(new jmri.configurexml.SaveMenu());
    menuBar.add(fileMenu);
    setJMenuBar(menuBar);
    addHelpMenu("package.jmri.jmrit.logix.CreateEditWarrant", true);
}
Also used : JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

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