MCPcopy Create free account
hub / github.com/dorkbox/SystemTray / setTooltip

Method setTooltip

src/dorkbox/systemTray/MenuItem.java:455–474  ·  view source on GitHub ↗

Specifies the tooltip text, usually this is used to brand the SystemTray icon with your product's name, or to provide extra information during mouse-over for menu entries. NOTE: Maximum length is 64 characters long, and it is not supported on all Operating Systems and Desktop Environments. F

(final String tooltipText)

Source from the content-addressed store, hash-verified

453 * @param tooltipText the text to use as a mouse-over tooltip for the tray icon or menu entry, null to remove.
454 */
455 public
456 void setTooltip(final String tooltipText) {
457 if (tooltipText != null) {
458 // this is a safety precaution, since the behavior of really long text is undefined.
459 if (tooltipText.length() > 64) {
460 throw new RuntimeException("Tooltip text cannot be longer than 64 characters.");
461 }
462
463 if (!alreadyEmittedTooltipWarning) {
464 alreadyEmittedTooltipWarning = true;
465 SystemTray.logger.warn("Please disable tooltips, as they are not consistent across all platforms and tray types.");
466 }
467 }
468
469 this.tooltip = tooltipText;
470
471 if (peer != null) {
472 ((MenuItemPeer) peer).setTooltip(this);
473 }
474 }
475
476 /**
477 * Gets the mouse-over tooltip for the meme entry.

Callers 3

TestTrayMethod · 0.95
TestTraySwtMethod · 0.95
doJavaFxStuffMethod · 0.95

Calls 1

setTooltipMethod · 0.65

Tested by 3

TestTrayMethod · 0.76
TestTraySwtMethod · 0.76
doJavaFxStuffMethod · 0.76