 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.gui.label;
30 import org.jetbrains.annotations.NotNull;
31 import org.jetbrains.annotations.Nullable;
167 if (tmpActiveGuiElement ==
null) {
172 if (tmpTooltip ==
null) {
177 if (tooltipText ==
null) {
178 tmpTooltip.setVisible(
false);
181 final String text = tooltipText.
getText();
182 if (text.isEmpty()) {
183 tmpTooltip.setVisible(
false);
187 tmpTooltip.setVisible(
true);
190 final int preferredX = tooltipText.
getX()+tooltipText.
getW()/2-tmpTooltip.getWidth()/2;
191 final int maxX =
windowWidth-tmpTooltip.getWidth();
192 final int tx = Math.max(0, Math.min(preferredX, maxX));
193 final int elementY = tooltipText.
getY();
196 tmpTooltip.setLocation(tx, ty);
208 if (tooltip !=
null) {
Utility class for Swing related functions.
int getW()
Returns the width of the associated gui element.
String getText()
Returns the text.
Abstract base class for GUI elements to be shown in Guis.
Abstract base class for all label classes.
static void invokeLater(@NotNull final Runnable runnable)
Calls SwingUtilities#invokeLater(Runnable) if not on the EDT or calls the Runnable directly if on the...
abstract TooltipText getTooltip()
Returns the current tooltip text.
int getX()
Returns the x coordinate of the associated gui element.
Interface defining an abstract GUI element.
int getY()
Returns the y coordinate of the associated gui element.
void setText(@NotNull final String text)
Sets the label text.
int getH()
Returns the height of the associated gui element.
Information for displaying tooltips.
static void invokeAndWait(@NotNull final Runnable runnable)
Calls SwingUtilities#invokeAndWait(Runnable) if not on the EDT or calls the Runnable directly if on t...