Example usage for javax.swing JMenu getToolTipText

List of usage examples for javax.swing JMenu getToolTipText

Introduction

In this page you can find the example usage for javax.swing JMenu getToolTipText.

Prototype

public String getToolTipText() 

Source Link

Document

Returns the tooltip string that has been set with setToolTipText.

Usage

From source file:org.openmicroscopy.shoola.env.ui.TaskBarView.java

/**
 * Copies the items from the specified menu and creates a new menu.
 *
 * @param original The menu to handle./*  w ww  .j  av a2s  . c  om*/
 * @return See above.
 */
private JMenu copyItemsFromMenu(JMenu original) {
    Component[] comps = original.getPopupMenu().getComponents();
    JMenu menu = new JMenu();
    menu.setText(original.getText());
    menu.setToolTipText(original.getToolTipText());
    ActionListener[] al = original.getActionListeners();
    for (int j = 0; j < al.length; j++)
        menu.addActionListener(al[j]);
    MenuKeyListener[] mkl = original.getMenuKeyListeners();
    for (int j = 0; j < mkl.length; j++)
        menu.addMenuKeyListener(mkl[j]);
    MenuListener[] ml = original.getMenuListeners();
    for (int j = 0; j < ml.length; j++)
        menu.addMenuListener(ml[j]);
    for (int i = 0; i < comps.length; i++) {
        if (comps[i] instanceof JMenu) {
            menu.add(copyItemsFromMenu((JMenu) comps[i]));
        } else if (comps[i] instanceof JMenuItem) {
            menu.add(copyItem((JMenuItem) comps[i]));
        } else if (comps[i] instanceof JSeparator) {
            menu.add(new JSeparator(JSeparator.HORIZONTAL));
        }
    }
    return menu;
}