Search in sources :

Example 1 with MouseInsideListener

use of org.freeplane.core.ui.MouseInsideListener in project freeplane by freeplane.

the class NodeTooltipManager method showTipWindow.

private void showTipWindow() {
    Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    if (insideComponent == null || !insideComponent.isShowing() || focusOwner == null)
        return;
    tip = insideComponent.createToolTip();
    tip.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            final NodeTooltip component = (NodeTooltip) e.getComponent();
            component.scrollUp();
            component.removeComponentListener(this);
        }
    });
    tip.setTipText(toolTipText);
    final JComponent nearComponent = insideComponent;
    focusOwnerRef = new WeakReference<Component>(focusOwner);
    tipPopup = new JPopupMenu();
    tipPopup.setLayout(new GridLayout(1, 1));
    tipPopup.add(tip);
    mouseInsideTooltipListener = new MouseInsideListener(tipPopup);
    tipPopup.show(nearComponent, 0, nearComponent.getHeight());
    focusOwner.requestFocusInWindow();
    exitTimer.start();
}
Also used : GridLayout(java.awt.GridLayout) MouseInsideListener(org.freeplane.core.ui.MouseInsideListener) JComponent(javax.swing.JComponent) ComponentEvent(java.awt.event.ComponentEvent) JComponent(javax.swing.JComponent) Component(java.awt.Component) JTextComponent(javax.swing.text.JTextComponent) ComponentAdapter(java.awt.event.ComponentAdapter) JPopupMenu(javax.swing.JPopupMenu)

Aggregations

Component (java.awt.Component)1 GridLayout (java.awt.GridLayout)1 ComponentAdapter (java.awt.event.ComponentAdapter)1 ComponentEvent (java.awt.event.ComponentEvent)1 JComponent (javax.swing.JComponent)1 JPopupMenu (javax.swing.JPopupMenu)1 JTextComponent (javax.swing.text.JTextComponent)1 MouseInsideListener (org.freeplane.core.ui.MouseInsideListener)1