Search in sources :

Example 1 with CheckboxMenuItem

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

the class CCheckboxMenuItem method handleAction.

public void handleAction(final boolean state) {
    final CheckboxMenuItem target = (CheckboxMenuItem) getTarget();
    SunToolkit.executeOnEventHandlerThread(target, new Runnable() {

        public void run() {
            target.setState(state);
        }
    });
    ItemEvent event = new ItemEvent(target, ItemEvent.ITEM_STATE_CHANGED, target.getLabel(), state ? ItemEvent.SELECTED : ItemEvent.DESELECTED);
    SunToolkit.postEvent(SunToolkit.targetToAppContext(getTarget()), event);
}
Also used : ItemEvent(java.awt.event.ItemEvent) CheckboxMenuItem(java.awt.CheckboxMenuItem)

Example 2 with CheckboxMenuItem

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

the class WCheckboxMenuItemPeer method handleAction.

// native callbacks
public void handleAction(final boolean state) {
    final CheckboxMenuItem target = (CheckboxMenuItem) this.target;
    WToolkit.executeOnEventHandlerThread(target, new Runnable() {

        @Override
        public void run() {
            target.setState(state);
            postEvent(new ItemEvent(target, ItemEvent.ITEM_STATE_CHANGED, target.getLabel(), (state) ? ItemEvent.SELECTED : ItemEvent.DESELECTED));
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) CheckboxMenuItem(java.awt.CheckboxMenuItem)

Example 3 with CheckboxMenuItem

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

the class AWTInputMethodPopupMenu method addMenuItem.

void addMenuItem(Object targetMenu, String label, String command, String currentSelection) {
    MenuItem menuItem;
    if (isSelected(command, currentSelection)) {
        menuItem = new CheckboxMenuItem(label, true);
    } else {
        menuItem = new MenuItem(label);
    }
    menuItem.setActionCommand(command);
    menuItem.addActionListener(this);
    menuItem.setEnabled(command != null);
    ((Menu) targetMenu).add(menuItem);
}
Also used : CheckboxMenuItem(java.awt.CheckboxMenuItem) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) MenuItem(java.awt.MenuItem) JMenuItem(javax.swing.JMenuItem) CheckboxMenuItem(java.awt.CheckboxMenuItem) JPopupMenu(javax.swing.JPopupMenu) JMenu(javax.swing.JMenu) Menu(java.awt.Menu) PopupMenu(java.awt.PopupMenu)

Aggregations

CheckboxMenuItem (java.awt.CheckboxMenuItem)3 ItemEvent (java.awt.event.ItemEvent)2 Menu (java.awt.Menu)1 MenuItem (java.awt.MenuItem)1 PopupMenu (java.awt.PopupMenu)1 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1 JPopupMenu (javax.swing.JPopupMenu)1