Search in sources :

Example 61 with JMenuBar

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

the class AddTaskDialog method createTaskTypeSelector.

private Component createTaskTypeSelector() {
    List<AddTaskTypeOption> taskTypes = handler.getTaskTypes(targetParent.path(), activeTask.path());
    taskTypeIcon = new JLabel();
    if (taskTypes.size() == 1) {
        setSelectedTaskType(taskTypes.get(0));
        return null;
    } else {
        JMenu typeMenu = makeTaskTypeMenu(taskTypes);
        new MouseHandler(typeMenu, taskTypeIcon);
        JMenuBar menuBar = new JMenuBar();
        menuBar.setMinimumSize(new Dimension(0, 0));
        menuBar.setPreferredSize(new Dimension(0, 1));
        menuBar.setMaximumSize(new Dimension(0, 100));
        menuBar.add(typeMenu);
        if (this.taskType == null)
            setSelectedTaskType(taskTypes.get(0));
        return menuBar;
    }
}
Also used : JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JMenu(javax.swing.JMenu) JMenuBar(javax.swing.JMenuBar)

Example 62 with JMenuBar

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

the class TeamProjectBrowser method augmentTeamDashboardFileMenu.

/**
     * Add team-project-related items to the File menu.
     */
private void augmentTeamDashboardFileMenu(ProcessDashboard dash) {
    JMenuBar menuBar = dash.getConfigurationMenus();
    if (Settings.isReadWrite()) {
        JMenu fileMenu = menuBar.getMenu(0);
        fileMenu.insert(new NewProjectAction(), 0);
        fileMenu.insert(new AlterTeamProjectMenu(), 1);
    }
    UserGroupManager groupMgr = UserGroupManager.getInstance();
    if (groupMgr.isEnabled()) {
        GroupFilterMenu groupFilterMenu = new GroupFilterMenu(UserGroup.EVERYONE, groupMgr.isIndivFilteringSupported());
        groupFilterMenu.addGroupChangeListener(handler);
        menuBar.add(Box.createHorizontalGlue());
        menuBar.add(groupFilterMenu);
    }
}
Also used : UserGroupManager(net.sourceforge.processdash.team.group.UserGroupManager) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu) GroupFilterMenu(net.sourceforge.processdash.team.group.ui.GroupFilterMenu)

Example 63 with JMenuBar

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

the class GitblitManager method getCenterPanel.

private JPanel getCenterPanel() {
    serverTabs = new JTabbedPane(JTabbedPane.TOP);
    JMenuBar menubar = setupMenu();
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(menubar, BorderLayout.NORTH);
    panel.add(serverTabs, BorderLayout.CENTER);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JTabbedPane(javax.swing.JTabbedPane) JMenuBar(javax.swing.JMenuBar)

Example 64 with JMenuBar

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

the class GitblitManager method setupMenu.

private JMenuBar setupMenu() {
    JMenuBar menuBar = new JMenuBar();
    JMenu serversMenu = new JMenu(Translation.get("gb.servers"));
    menuBar.add(serversMenu);
    recentMenu = new JMenu(Translation.get("gb.recent"));
    serversMenu.add(recentMenu);
    JMenuItem manage = new JMenuItem(Translation.get("gb.manage") + "...");
    manage.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_DOWN_MASK, false));
    manage.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            manageRegistrations();
        }
    });
    serversMenu.add(manage);
    return menuBar;
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JMenuItem(javax.swing.JMenuItem) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu)

Example 65 with JMenuBar

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

the class PreAlpha method initializeComponents.

private void initializeComponents() {
    //Create the menu bar.
    JMenuBar menuBar = new JMenuBar();
    //Build the first menu.
    JMenu menu = new JMenu("File");
    menuBar.add(menu);
    //a group of JMenuItems
    JMenuItem menuItem = new JMenuItem("Open");
    menuItem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            open();
        }
    });
    menu.add(menuItem);
    menuItem = new JMenuItem("Save");
    menuItem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            save();
        }
    });
    menu.add(menuItem);
    setJMenuBar(menuBar);
    imagePanel = new ImagePanel();
    getContentPane().add(imagePanel);
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JMenuItem(javax.swing.JMenuItem) 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