Author: echatellier Date: 2010-03-15 12:00:06 +0100 (Mon, 15 Mar 2010) New Revision: 401 Log: Allow tooltip on all JComponent Modified: testTreeTooltipSession/trunk/src/main/java/org/nuiton/test/focusabletip/FocusableTip.java Modified: testTreeTooltipSession/trunk/src/main/java/org/nuiton/test/focusabletip/FocusableTip.java =================================================================== --- testTreeTooltipSession/trunk/src/main/java/org/nuiton/test/focusabletip/FocusableTip.java 2010-03-12 14:26:53 UTC (rev 400) +++ testTreeTooltipSession/trunk/src/main/java/org/nuiton/test/focusabletip/FocusableTip.java 2010-03-15 11:00:06 UTC (rev 401) @@ -60,7 +60,7 @@ private JComponent attachedComponent; private TipWindow tipWindow; private URL imageBase; - private TextAreaListener textAreaListener; + private AttachedComponentListener attachedComponentListener; private HyperlinkListener hyperlinkListener; private String lastText; @@ -82,7 +82,7 @@ public FocusableTip(JComponent attachedComponent, HyperlinkListener listener) { setAttachedComponent(attachedComponent); this.hyperlinkListener = listener; - textAreaListener = new TextAreaListener(); + attachedComponentListener = new AttachedComponentListener(); tipVisibleBounds = new Rectangle(); } @@ -149,7 +149,7 @@ tipWindow.setVisible(true); tipWindow.toFront(); computeTipVisibleBounds(); // Do after tip is visible - textAreaListener.install(attachedComponent); + attachedComponentListener.install(attachedComponent); lastText = text; } @@ -187,7 +187,7 @@ if (tipWindow != null) { tipWindow.dispose(); tipWindow = null; - textAreaListener.uninstall(); + attachedComponentListener.uninstall(); tipVisibleBounds.setBounds(-1, -1, 0, 0); lastText = null; attachedComponent.requestFocus(); @@ -197,7 +197,7 @@ void removeListeners() { //System.out.println("DEBUG: Removing text area listeners"); - textAreaListener.uninstall(); + attachedComponentListener.uninstall(); } @@ -236,7 +236,7 @@ } - private class TextAreaListener extends MouseInputAdapter implements + private class AttachedComponentListener extends MouseInputAdapter implements CaretListener, ComponentListener, FocusListener, KeyListener { public void caretUpdate(CaretEvent e) {