Search in sources :

Example 6 with MenuItem

use of java.awt.MenuItem in project jdk8u_jdk by JetBrains.

the class CMenu method setEnabled.

@Override
public final void setEnabled(final boolean b) {
    super.setEnabled(b);
    final Menu target = (Menu) getTarget();
    final int count = target.getItemCount();
    for (int i = 0; i < count; ++i) {
        MenuItem item = target.getItem(i);
        MenuItemPeer p = (MenuItemPeer) LWCToolkit.targetToPeer(item);
        if (p != null) {
            p.setEnabled(b && item.isEnabled());
        }
    }
}
Also used : MenuItemPeer(java.awt.peer.MenuItemPeer) MenuItem(java.awt.MenuItem) Menu(java.awt.Menu)

Example 7 with MenuItem

use of java.awt.MenuItem in project processdash by dtuma.

the class MenuHandler method makeShowWindowMenuItem.

private MenuItem makeShowWindowMenuItem(ProcessDashboard pdash) {
    String windowTitle = pdash.getTitle();
    String menuText = res.format("Show_Window_FMT", windowTitle);
    MenuItem showWindow = new MenuItem(menuText);
    showWindow.addActionListener(showWindowAction);
    return showWindow;
}
Also used : MenuItem(java.awt.MenuItem)

Example 8 with MenuItem

use of java.awt.MenuItem in project processdash by dtuma.

the class MenuHandler method makeChangeTaskMenuItem.

private MenuItem makeChangeTaskMenuItem() {
    MenuItem changeTaskItem = new MenuItem(res.getString("Change_Task"));
    changeTaskItem.addActionListener(changeTaskAction);
    return changeTaskItem;
}
Also used : MenuItem(java.awt.MenuItem)

Example 9 with MenuItem

use of java.awt.MenuItem in project screenbird by adamhub.

the class ScreenRecorder method createTray.

/**
     * Sets up the system tray for screenRecorder application
     */
private void createTray() {
    PopupMenu menu = new PopupMenu();
    MenuItem aboutItem = new MenuItem("About");
    aboutItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(jfRecorderPanel, String.format("Screenbird%nBuild Version %s", RecorderPanel.resources.getString("BUILD")));
        }
    });
    menu.add(aboutItem);
    // Open the settings menu
    MenuItem settingsItem = new MenuItem("Preferences");
    settingsItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (jpRecorderPanel.isRecorderConfigSate())
                jpRecorderPanel.showSettingsForm();
        }
    });
    menu.add(settingsItem);
    // Hide or show the recorder 
    MenuItem messageItem = new MenuItem("Hide/Show");
    messageItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (jfRecorderPanel.getState() == JFrame.NORMAL) {
                jfRecorderPanel.setState(JFrame.ICONIFIED);
            } else {
                jfRecorderPanel.setState(JFrame.NORMAL);
            }
        }
    });
    menu.add(messageItem);
    MenuItem closeItem = new MenuItem("Quit/Exit");
    closeItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            destroy();
        }
    });
    menu.add(closeItem);
    // Loads the pastevid logo
    Image icon = Toolkit.getDefaultToolkit().getImage(getClass().getResource(ResourceUtil.LOGO_16));
    if (!MediaUtil.osIsWindows()) {
        icon = Toolkit.getDefaultToolkit().getImage(getClass().getResource(ResourceUtil.LOGO_24));
    }
    // Assigns the pastevid logo
    TrayIcon tray = new TrayIcon(icon, "Screenbird", menu);
    try {
        SystemTray.getSystemTray().add(tray);
    } catch (AWTException ex) {
        log(ex);
    }
}
Also used : ActionListener(java.awt.event.ActionListener) TrayIcon(java.awt.TrayIcon) ActionEvent(java.awt.event.ActionEvent) MenuItem(java.awt.MenuItem) Image(java.awt.Image) PopupMenu(java.awt.PopupMenu) AWTException(java.awt.AWTException)

Example 10 with MenuItem

use of java.awt.MenuItem in project openblocks by mikaelhg.

the class ContextMenu method initRemoveCommentMenu.

/**
     * Initializes the context menu for deleting Comments.
     */
private static void initRemoveCommentMenu() {
    removeCommentItem = new MenuItem("Delete Comment");
    removeCommentItem.setActionCommand(REMOVE_COMMENT_BLOCK);
    removeCommentItem.addActionListener(rndBlockMenu);
    removeCommentMenu.add(removeCommentItem);
    //rndBlockMenu.add(runBlockItem);
    removeCommentMenuInit = true;
}
Also used : MenuItem(java.awt.MenuItem)

Aggregations

MenuItem (java.awt.MenuItem)18 PopupMenu (java.awt.PopupMenu)4 FileDialog (java.awt.FileDialog)3 Image (java.awt.Image)3 Menu (java.awt.Menu)3 MenuShortcut (java.awt.MenuShortcut)3 TrayIcon (java.awt.TrayIcon)3 AWTException (java.awt.AWTException)2 Dimension (java.awt.Dimension)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 SQLException (java.sql.SQLException)2 JMenuItem (javax.swing.JMenuItem)2 JPopupMenu (javax.swing.JPopupMenu)2 CheckboxMenuItem (java.awt.CheckboxMenuItem)1 Frame (java.awt.Frame)1 Insets (java.awt.Insets)1 MenuBar (java.awt.MenuBar)1 TextField (java.awt.TextField)1 WindowEvent (java.awt.event.WindowEvent)1