43 * <code>setToolTipText</code> method to specify the text
44 * for a standard tooltip. A component that wants to create a custom
45 * <code>ToolTip</code>
46 * display can override <code>JComponent</code>'s <code>createToolTip</code>
47 * method and use a subclass of this class.
48 * <p>
49 * See <a href="https://docs.oracle.com/javase/tutorial/uiswing/components/tooltip.html">How to Use Tool Tips</a>
50 * in <em>The Java Tutorial</em>
51 * for further documentation.
52 * <p>
53 * <strong>Warning:</strong> Swing is not thread safe. For more
54 * information see <a
55 * href="package-summary.html#threading">Swing's Threading
56 * Policy</a>.
57 * <p>
58 * <strong>Warning:</strong>
59 * Serialized objects of this class will not be compatible with
60 * future Swing releases. The current serialization support is
61 * appropriate for short term storage or RMI between applications running
62 * the same version of Swing. As of 1.4, support for long term storage
63 * of all JavaBeans™
64 * has been added to the <code>java.beans</code> package.
65 * Please see {@link java.beans.XMLEncoder}.
66 *
67 * @see JComponent#setToolTipText
68 * @see JComponent#createToolTip
69 * @author Dave Moore
70 * @author Rich Shiavi
71 * @since 1.2
72 */
73 @SuppressWarnings("serial")
74 public class JToolTip extends JComponent implements Accessible {
75 /**
76 * @see #getUIClassID
77 * @see #readObject
78 */
79 private static final String uiClassID = "ToolTipUI";
80
81 String tipText;
82 JComponent component;
83
237 * @return an AccessibleJToolTip that serves as the
238 * AccessibleContext of this JToolTip
239 */
240 public AccessibleContext getAccessibleContext() {
241 if (accessibleContext == null) {
242 accessibleContext = new AccessibleJToolTip();
243 }
244 return accessibleContext;
245 }
246
247 /**
248 * This class implements accessibility support for the
249 * <code>JToolTip</code> class. It provides an implementation of the
250 * Java Accessibility API appropriate to tool tip user-interface elements.
251 * <p>
252 * <strong>Warning:</strong>
253 * Serialized objects of this class will not be compatible with
254 * future Swing releases. The current serialization support is
255 * appropriate for short term storage or RMI between applications running
256 * the same version of Swing. As of 1.4, support for long term storage
257 * of all JavaBeans™
258 * has been added to the <code>java.beans</code> package.
259 * Please see {@link java.beans.XMLEncoder}.
260 */
261 @SuppressWarnings("serial")
262 protected class AccessibleJToolTip extends AccessibleJComponent {
263
264 /**
265 * Get the accessible description of this object.
266 *
267 * @return a localized String describing this object.
268 */
269 public String getAccessibleDescription() {
270 String description = accessibleDescription;
271
272 // fallback to client property
273 if (description == null) {
274 description = (String)getClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY);
275 }
276 if (description == null) {
277 description = getTipText();
|
43 * <code>setToolTipText</code> method to specify the text
44 * for a standard tooltip. A component that wants to create a custom
45 * <code>ToolTip</code>
46 * display can override <code>JComponent</code>'s <code>createToolTip</code>
47 * method and use a subclass of this class.
48 * <p>
49 * See <a href="https://docs.oracle.com/javase/tutorial/uiswing/components/tooltip.html">How to Use Tool Tips</a>
50 * in <em>The Java Tutorial</em>
51 * for further documentation.
52 * <p>
53 * <strong>Warning:</strong> Swing is not thread safe. For more
54 * information see <a
55 * href="package-summary.html#threading">Swing's Threading
56 * Policy</a>.
57 * <p>
58 * <strong>Warning:</strong>
59 * Serialized objects of this class will not be compatible with
60 * future Swing releases. The current serialization support is
61 * appropriate for short term storage or RMI between applications running
62 * the same version of Swing. As of 1.4, support for long term storage
63 * of all JavaBeans
64 * has been added to the <code>java.beans</code> package.
65 * Please see {@link java.beans.XMLEncoder}.
66 *
67 * @see JComponent#setToolTipText
68 * @see JComponent#createToolTip
69 * @author Dave Moore
70 * @author Rich Shiavi
71 * @since 1.2
72 */
73 @SuppressWarnings("serial")
74 public class JToolTip extends JComponent implements Accessible {
75 /**
76 * @see #getUIClassID
77 * @see #readObject
78 */
79 private static final String uiClassID = "ToolTipUI";
80
81 String tipText;
82 JComponent component;
83
237 * @return an AccessibleJToolTip that serves as the
238 * AccessibleContext of this JToolTip
239 */
240 public AccessibleContext getAccessibleContext() {
241 if (accessibleContext == null) {
242 accessibleContext = new AccessibleJToolTip();
243 }
244 return accessibleContext;
245 }
246
247 /**
248 * This class implements accessibility support for the
249 * <code>JToolTip</code> class. It provides an implementation of the
250 * Java Accessibility API appropriate to tool tip user-interface elements.
251 * <p>
252 * <strong>Warning:</strong>
253 * Serialized objects of this class will not be compatible with
254 * future Swing releases. The current serialization support is
255 * appropriate for short term storage or RMI between applications running
256 * the same version of Swing. As of 1.4, support for long term storage
257 * of all JavaBeans
258 * has been added to the <code>java.beans</code> package.
259 * Please see {@link java.beans.XMLEncoder}.
260 */
261 @SuppressWarnings("serial")
262 protected class AccessibleJToolTip extends AccessibleJComponent {
263
264 /**
265 * Get the accessible description of this object.
266 *
267 * @return a localized String describing this object.
268 */
269 public String getAccessibleDescription() {
270 String description = accessibleDescription;
271
272 // fallback to client property
273 if (description == null) {
274 description = (String)getClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY);
275 }
276 if (description == null) {
277 description = getTipText();
|