Example usage for java.awt MenuItem setLabel

List of usage examples for java.awt MenuItem setLabel

Introduction

In this page you can find the example usage for java.awt MenuItem setLabel.

Prototype

public synchronized void setLabel(String label) 

Source Link

Document

Sets the label for this menu item to the specified label.

Usage

From source file:net.java.sip.communicator.impl.osdependent.jdic.TrayMenuFactory.java

/**
 * Changes the tray menu item properties, like name, text and icon.
 * @param trayItem the tray menu item to change
 * @param name the new name of the item/* www.j a v  a2  s  . c om*/
 * @param textID the new text identifier
 * @param iconID the new icon string identifier
 */
private static void changeTrayMenuItem(Object trayItem, String name, String textID, String iconID) {
    String text = Resources.getString(textID);

    if (trayItem instanceof JMenuItem) {
        JMenuItem jmenuItem = (JMenuItem) trayItem;
        jmenuItem.setName(name);
        jmenuItem.setText(text);
        jmenuItem.setIcon(Resources.getImage(iconID));
    } else if (trayItem instanceof MenuItem) {
        MenuItem menuItem = (MenuItem) trayItem;
        menuItem.setName(name);
        menuItem.setLabel(text);
    }
}