Search in sources :

Example 36 with JMenuBar

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

the class PaneOpsProgAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    if (log.isDebugEnabled()) {
        log.debug("Pane programmer requested");
    }
    // create the initial frame that steers
    final JmriJFrame f = new JmriJFrame(SymbolicProgBundle.getMessage("FrameOpsProgrammerSetup"));
    f.getContentPane().setLayout(new BoxLayout(f.getContentPane(), BoxLayout.Y_AXIS));
    // add the Roster menu
    JMenuBar menuBar = new JMenuBar();
    // menuBar.setBorder(new BevelBorder(BevelBorder.RAISED));
    menuBar.add(new jmri.jmrit.roster.swing.RosterMenu(SymbolicProgBundle.getMessage("MenuRoster"), jmri.jmrit.roster.swing.RosterMenu.MAINMENU, f));
    f.setJMenuBar(menuBar);
    // known loco on main track
    JPanel pane1 = new // no ident in ops mode yet
    KnownLocoSelPane(// no ident in ops mode yet
    false) {

        @Override
        protected void startProgrammer(DecoderFile decoderFile, RosterEntry re, String filename) {
            String title = java.text.MessageFormat.format(SymbolicProgBundle.getMessage("FrameOpsProgrammerTitle"), new Object[] { re.getId() });
            // find the ops-mode programmer
            int address = Integer.parseInt(re.getDccAddress());
            boolean longAddr = re.isLongAddress();
            Programmer programmer = InstanceManager.getDefault(jmri.ProgrammerManager.class).getAddressedProgrammer(longAddr, address);
            // and created the frame
            JFrame p = new PaneOpsProgFrame(decoderFile, re, title, "programmers" + File.separator + filename + ".xml", programmer);
            p.pack();
            p.setVisible(true);
        // f.setVisible(false);
        // f.dispose();
        }
    };
    // load primary frame
    pane1.setAlignmentX(JLabel.CENTER_ALIGNMENT);
    f.getContentPane().add(pane1);
    f.pack();
    if (log.isDebugEnabled()) {
        log.debug("Tab-Programmer setup created");
    }
    f.setVisible(true);
}
Also used : JPanel(javax.swing.JPanel) DecoderFile(jmri.jmrit.decoderdefn.DecoderFile) BoxLayout(javax.swing.BoxLayout) KnownLocoSelPane(jmri.jmrit.symbolicprog.KnownLocoSelPane) JmriJFrame(jmri.util.JmriJFrame) Programmer(jmri.Programmer) JmriJFrame(jmri.util.JmriJFrame) JFrame(javax.swing.JFrame) RosterEntry(jmri.jmrit.roster.RosterEntry) JMenuBar(javax.swing.JMenuBar)

Example 37 with JMenuBar

use of javax.swing.JMenuBar in project tika by apache.

the class TikaGUI method addMenuBar.

private void addMenuBar() {
    JMenuBar bar = new JMenuBar();
    JMenu file = new JMenu("File");
    file.setMnemonic(KeyEvent.VK_F);
    addMenuItem(file, "Open...", "openfile", KeyEvent.VK_O);
    addMenuItem(file, "Open URL...", "openurl", KeyEvent.VK_U);
    file.addSeparator();
    addMenuItem(file, "Exit", "exit", KeyEvent.VK_X);
    bar.add(file);
    JMenu view = new JMenu("View");
    view.setMnemonic(KeyEvent.VK_V);
    addMenuItem(view, "Metadata", "metadata", KeyEvent.VK_M);
    addMenuItem(view, "Formatted text", "html", KeyEvent.VK_F);
    addMenuItem(view, "Plain text", "text", KeyEvent.VK_P);
    addMenuItem(view, "Main content", "main", KeyEvent.VK_C);
    addMenuItem(view, "Structured text", "xhtml", KeyEvent.VK_S);
    addMenuItem(view, "Recursive JSON", "json", KeyEvent.VK_J);
    bar.add(view);
    bar.add(Box.createHorizontalGlue());
    JMenu help = new JMenu("Help");
    help.setMnemonic(KeyEvent.VK_H);
    addMenuItem(help, "About Tika", "about", KeyEvent.VK_A);
    bar.add(help);
    setJMenuBar(bar);
}
Also used : JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

Example 38 with JMenuBar

use of javax.swing.JMenuBar in project processdash by dtuma.

the class WBSEditor method buildMenuBar.

private JMenuBar buildMenuBar(WBSTabPanel tabPanel, WBSModel workflows, WBSModel milestones, DataTableModel dataModel, String initials) {
    JMenuBar result = new JMenuBar();
    result.add(buildFileMenu(dataModel, tabPanel.getFileActions()));
    result.add(buildEditMenu(tabPanel.getEditingActions()));
    result.add(buildTabMenu(tabPanel.getTabActions()));
    if (!isMode(MODE_BOTTOM_UP))
        result.add(buildWorkflowMenu(workflows, tabPanel.getWorkflowActions(workflows), tabPanel.getInsertWorkflowAction(workflows)));
    result.add(buildMilestonesMenu(milestones));
    if (isMode(MODE_HAS_MASTER) && "true".equals(teamProject.getUserSetting("showMasterMenu")))
        result.add(buildMasterMenu(tabPanel.getMasterActions(teamProject)));
    if (!isMode(MODE_MASTER))
        result.add(buildTeamMenu(initials, dataModel));
    return result;
}
Also used : JMenuBar(javax.swing.JMenuBar)

Example 39 with JMenuBar

use of javax.swing.JMenuBar in project processdash by dtuma.

the class HierarchyEditor method constructMenuBar.

/** Construct a menu. */
private JMenuBar constructMenuBar() {
    JMenu menu;
    JMenuBar menuBar = new JMenuBar();
    JMenuItem menuItem;
    /* File Options (close, save, revert). */
    menu = new JMenu(resource.getString("File"));
    menuBar.add(menu);
    menuItem = menu.add(new JMenuItem(resource.getString("Close")));
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            confirmClose(true);
        }
    });
    saveMenuItem = new JMenuItem(resource.getString("Save"));
    if (Settings.isReadWrite())
        menu.add(saveMenuItem);
    saveMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            saveProperties();
        }
    });
    revertMenuItem = new JMenuItem(resource.getString("Revert"));
    if (Settings.isReadWrite())
        menu.add(revertMenuItem);
    revertMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            tree.getSelectionModel().clearSelection();
            // reset properties
            revertProperties();
            // remove listener while reloading
            treeModel.useTreeModelListener(false);
            // remove children of root
            treeModel.reload(useProps);
            expandRoot();
            // restore listener
            treeModel.useTreeModelListener(true);
        }
    });
    setDirty(false);
    /* Tree related stuff. */
    menu = new JMenu(resource.getString("Edit"));
    if (Settings.isReadWrite())
        menuBar.add(menu);
    deleteMenuItem = menu.add(new JMenuItem(resource.getString("Delete")));
    deleteMenuItem.addActionListener(new RemoveAction());
    deleteMenuItem.setEnabled(false);
    menu.add(renameAction = new RenameAction());
    renameAction.setEnabled(false);
    menu.add(moveUpAction = new MoveUpAction());
    moveUpAction.setEnabled(false);
    menu.add(moveDownAction = new MoveDownAction());
    moveDownAction.setEnabled(false);
    menu.add(cutAction = new CutAction());
    cutAction.setEnabled(false);
    menu.add(pasteAction = new PasteAction());
    pasteAction.setEnabled(false);
    menu.addSeparator();
    addNodeMenu = (JMenu) menu.add(new JMenu(resource.getString("HierarchyAddNode")));
    addNodeMenu.setPopupMenuVisible(false);
    addNodeMenu.add(addNodeAboveAction = new InsertAction());
    addNodeMenu.add(addNodeBelowAction = new AddAction());
    addNodeMenu.add(addNodeChildAction = new AddChildAction());
    addTemplateMenu = (JMenu) menu.add(new JMenu(resource.getString("HierarchyAddTemplate")));
    addTemplateMenu.setPopupMenuVisible(false);
    return menuBar;
}
Also used : ActionEvent(java.awt.event.ActionEvent) ActionListener(java.awt.event.ActionListener) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu) JMenuBar(javax.swing.JMenuBar)

Example 40 with JMenuBar

use of javax.swing.JMenuBar in project cytoscape-api by cytoscape.

the class JMenuTrackerTest method setUp.

@Before
public void setUp() {
    popup = new JPopupMenu("test");
    tracker = new JMenuTracker(popup);
    menuBar = new JMenuBar();
    menuBarTracker = new JMenuTracker(menuBar);
}
Also used : JPopupMenu(javax.swing.JPopupMenu) JMenuBar(javax.swing.JMenuBar) Before(org.junit.Before)

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