Search in sources :

Example 1 with MenuItemPeer

use of java.awt.peer.MenuItemPeer 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 2 with MenuItemPeer

use of java.awt.peer.MenuItemPeer in project jdk8u_jdk by JetBrains.

the class MenuItem method deleteShortcut.

/*
     * Delete a matching MenuShortcut associated with this MenuItem.
     * Used when iterating Menus.
     */
void deleteShortcut(MenuShortcut s) {
    if (s.equals(shortcut)) {
        shortcut = null;
        MenuItemPeer peer = (MenuItemPeer) this.peer;
        if (peer != null) {
            peer.setLabel(label);
        }
    }
}
Also used : MenuItemPeer(java.awt.peer.MenuItemPeer)

Example 3 with MenuItemPeer

use of java.awt.peer.MenuItemPeer in project jdk8u_jdk by JetBrains.

the class MenuItem method setShortcut.

/**
     * Set the <code>MenuShortcut</code> object associated with this
     * menu item. If a menu shortcut is already associated with
     * this menu item, it is replaced.
     * @param       s  the menu shortcut to associate
     *                           with this menu item.
     * @see         java.awt.MenuItem#getShortcut
     * @since       JDK1.1
     */
public void setShortcut(MenuShortcut s) {
    shortcut = s;
    MenuItemPeer peer = (MenuItemPeer) this.peer;
    if (peer != null) {
        peer.setLabel(label);
    }
}
Also used : MenuItemPeer(java.awt.peer.MenuItemPeer)

Example 4 with MenuItemPeer

use of java.awt.peer.MenuItemPeer in project jdk8u_jdk by JetBrains.

the class MenuItem method setLabel.

/**
     * Sets the label for this menu item to the specified label.
     * @param     label   the new label, or <code>null</code> for no label.
     * @see       java.awt.MenuItem#getLabel
     * @since     JDK1.0
     */
public synchronized void setLabel(String label) {
    this.label = label;
    MenuItemPeer peer = (MenuItemPeer) this.peer;
    if (peer != null) {
        peer.setLabel(label);
    }
}
Also used : MenuItemPeer(java.awt.peer.MenuItemPeer)

Example 5 with MenuItemPeer

use of java.awt.peer.MenuItemPeer in project jdk8u_jdk by JetBrains.

the class MenuItem method deleteShortcut.

/**
     * Delete any <code>MenuShortcut</code> object associated
     * with this menu item.
     * @since      JDK1.1
     */
public void deleteShortcut() {
    shortcut = null;
    MenuItemPeer peer = (MenuItemPeer) this.peer;
    if (peer != null) {
        peer.setLabel(label);
    }
}
Also used : MenuItemPeer(java.awt.peer.MenuItemPeer)

Aggregations

MenuItemPeer (java.awt.peer.MenuItemPeer)7 Menu (java.awt.Menu)1 MenuItem (java.awt.MenuItem)1