Example usage for javax.swing JToolTip getComponent

List of usage examples for javax.swing JToolTip getComponent

Introduction

In this page you can find the example usage for javax.swing JToolTip getComponent.

Prototype

public JComponent getComponent() 

Source Link

Document

Returns the component the tooltip applies to.

Usage

From source file:org.underworldlabs.swing.plaf.base.AcceleratorToolTipUI.java

private String getAcceleratorString(JToolTip tip) {

    String acceleratorString = null;
    Action action = ((AbstractButton) tip.getComponent()).getAction();

    if (action != null) {

        KeyStroke keyStroke = (KeyStroke) action.getValue(Action.ACCELERATOR_KEY);
        if (keyStroke != null) {

            int mod = keyStroke.getModifiers();
            acceleratorString = KeyEvent.getKeyModifiersText(mod);

            if (!MiscUtils.isNull(acceleratorString)) {

                acceleratorString += DELIMITER;
            }/*from  w  w w  .  j  av  a  2s.co  m*/

            String keyText = KeyEvent.getKeyText(keyStroke.getKeyCode());
            if (!MiscUtils.isNull(keyText)) {

                acceleratorString += keyText;
            }

        }

    }

    return acceleratorString;
}