summaryrefslogtreecommitdiff
path: root/javax/swing/JToolTip.java
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2004-07-31 15:24:01 +0000
committerMark Wielaard <mark@klomp.org>2004-07-31 15:24:01 +0000
commit4c06e4bf41943a9363fa4796ba8b4046123f8522 (patch)
treee980b991407452e45156fdd9ec2a543e7dfadcff /javax/swing/JToolTip.java
parent27838df28d8a7d2f534a66ea00a28714eb879536 (diff)
downloadclasspath-4c06e4bf41943a9363fa4796ba8b4046123f8522.tar.gz
2004-07-31 Kim Ho <kho@redhat.com>
* java/awt/Container.java: (acquireComponentForMouseEvent): Respect the event mask when looking for candidate. * javax/swing/JComponent.java: Remove toolTip field. (createToolTip): Create a tooltip on demand. (setToolTipText): Register with the ToolTipManager. (getToolTipText(MouseEvent)): Return getToolTipText(). * javax/swing/JToolTip.java: Implement. * javax/swing/Timer.java: Jalopy. (restart): Call stop, then start. (stop): Interrupt the timer rather than wait for the timer to come to a stop naturally. * javax/swing/ToolTipManager.java: Implement. * javax/swing/plaf/basic/BasicLookAndFeel.java: Change ToolTip.background color. * javax/swing/plaf/basic/BasicToolTipUI.java: Implement.
Diffstat (limited to 'javax/swing/JToolTip.java')
-rw-r--r--javax/swing/JToolTip.java147
1 files changed, 141 insertions, 6 deletions
diff --git a/javax/swing/JToolTip.java b/javax/swing/JToolTip.java
index 87e4610db..daf9f0a21 100644
--- a/javax/swing/JToolTip.java
+++ b/javax/swing/JToolTip.java
@@ -1,4 +1,4 @@
-/* JToolTip.java --
+/* JToolTip.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,25 +35,160 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing;
+import java.awt.AWTEvent;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.swing.plaf.ToolTipUI;
+
+/**
+ * This class is used to display ToolTips. ToolTips are small floating windows
+ * that display text when the mouse comes to rest over a Component. ToolTips
+ * are set for JComponents using JComponent.setToolTipText(String).
+ */
public class JToolTip extends JComponent implements Accessible
{
+ /** DOCUMENT ME! */
private static final long serialVersionUID = -1138929898906751643L;
-
+
+ /**
+ * DOCUMENT ME!
+ */
+ protected class AccessibleJToolTip extends AccessibleJComponent
+ {
+ /**
+ * Creates a new AccessibleJToolTip object.
+ */
+ protected AccessibleJToolTip()
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public String getAccessibleDescription()
+ {
+ return null;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return null;
+ }
+ }
+
+ /** The text to display in the JToolTip. */
String text;
+ /** The JComponent this JToolTip is used for. */
+ JComponent component;
+
+ /**
+ * Creates a new JToolTip object.
+ */
public JToolTip()
{
+ disableEvents(AWTEvent.MOUSE_EVENT_MASK);
+ updateUI();
}
- public void setTipText(String newText)
+ /**
+ * This method returns the text this JToolTip displays.
+ *
+ * @return The text that this JToolTip displays.
+ */
+ public String getTipText()
{
- this.text = newText;
+ return text;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return null;
}
-}
+ /**
+ * This method returns the JComponent this JToolTip displays for.
+ *
+ * @return The JComponent this JToolTip displays for.
+ */
+ public JComponent getComponent()
+ {
+ return component;
+ }
+ /**
+ * This method returns the UI responsible for displaying this JToolTip.
+ *
+ * @return The UI responsible for displaying this JToolTip.
+ */
+ public ToolTipUI getUI()
+ {
+ return (ToolTipUI) ui;
+ }
+
+ /**
+ * This method returns the String identifier for the UI class.
+ *
+ * @return The String identifier for the UI class.
+ */
+ public String getUIClassID()
+ {
+ return "ToolTipUI";
+ }
+
+ /**
+ * This method returns a debugging String describing the JToolTip.
+ *
+ * @return A debugging String describing the JToolTip.
+ */
+ protected String paramString()
+ {
+ return "JToolTip";
+ }
+
+ /**
+ * This method sets the JComponent that the JToolTip displays for.
+ *
+ * @param c The JComponent that the JToolTip displays for.
+ */
+ public void setComponent(JComponent c)
+ {
+ component = c;
+ }
+
+ /**
+ * This method sets the text that the JToolTip displays.
+ *
+ * @param tipText The text that the JToolTip displays.
+ */
+ public void setTipText(String tipText)
+ {
+ text = tipText;
+ }
+
+ /**
+ * This method resets the UI used to the Look and Feel default.
+ */
+ public void updateUI()
+ {
+ setUI((ToolTipUI) UIManager.getUI(this));
+ revalidate();
+ repaint();
+ }
+}