22 package com.realtime.crossfire.jxclient.gui.gui;
25 import java.awt.Transparency;
26 import java.awt.event.MouseEvent;
27 import javax.swing.JComponent;
28 import org.jetbrains.annotations.NotNull;
29 import org.jetbrains.annotations.Nullable;
94 pendingChange =
false;
101 if (changedListener != null) {
117 setDoubleBuffered(
false);
121 setOpaque(transparency != Transparency.TRANSLUCENT);
194 public void mouseEntered(@NotNull
final MouseEvent e,
final boolean debugGui) {
241 if (!pendingChange) {
242 pendingChange =
true;
260 public void setTooltipText(@Nullable
final String tooltipText,
final int x,
final int y,
final int w,
final int h) {
Listener for GUIElement related events.
static Gui getGui(@NotNull final Component element)
Returns the Gui an element is part of.
Combines a list of GUIElements to for a gui.
final Runnable setChangedRunnable
The Runnable that implements the code of setChanged() which must run on the EDT.
final TooltipManager tooltipManager
The TooltipManager to update.
void setChangedListener(@Nullable final GUIElementChangedListener changedListener)
Sets the GUIElementChangedListener to be notified.Note that at most one such listener may be set per ...
void setChanged()
Records that the contents have changed and must be repainted.
void dispose()
Releases all allocated resources.
final GUIElementListener elementListener
The GUIElementListener to notify.
boolean isIgnore()
Returns whether this gui element is to be ignored for user interaction.whether this gui element is ig...
final String name
The name of this element.
Interface defining an abstract GUI element.
static final long serialVersionUID
The serial version UID.
boolean ignore
Whether this gui element should be ignored for user interaction.
AbstractGUIElement(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, final int transparency)
Creates a new instance.
void mouseDragged(@NotNull final MouseEvent e)
Will be called when the mouse moves within this component while the button is pressed.This event will be delivered after mouseMoved(MouseEvent). Note: if the mouse leaves this element's bounding box while the mouse button is still pressed, furthermouseDragged (but nomouseMoved ) events will be generated. the mouse event relative to this element
boolean isDefault
Whether this element is the default element.
void mouseExited(@NotNull final MouseEvent e)
Will be called when the mouse has left the bounding box of this element.This function will not be cal...
static void invokeLater(@NotNull final Runnable runnable)
Calls SwingUtilities#invokeLater(Runnable) if not on the EDT or calls the Runnable directly if on the...
String getName()
Returns the internal name of this gui element.The name is used in skin files for identifying an eleme...
GUIElementChangedListener changedListener
The GUIElementChangedListener to be notified whenever this element has changed.
Utility class for Gui related functions.
void setTooltipText(@Nullable final String tooltipText)
Sets the tooltip text to show when the mouse is inside this element.the text to show ornull to disab...
void mouseEntered(@NotNull final MouseEvent e, final boolean debugGui)
Will be called when the mouse has entered the bounding box of this element.the mouse event relative t...
void mouseReleased(@NotNull final MouseEvent e)
Will be called when the user has released the mouse.This event may be delivered even if no previous m...
Utility class for Swing related functions.
Interface for listeners interested in the changed flag of GUIElement instances.
Abstract base class for GUI elements to be shown in Guis.
boolean hasTooltipText()
Returns whether the tooltip is enabled.whether the tooltip is enabled
void setDefault(final boolean isDefault)
Sets whether this element is the default element.The default element is selected with the ENTER key...
boolean isDefault()
Returns whether this element is the default element.The default element is selected with the ENTER ke...
void mouseClicked(@NotNull final MouseEvent e)
Will be called when the user has clicked (pressed+released) this element.This event will be delivered...
void raiseDialog(@NotNull Component component)
The Gui of a Component should be raised.
void setTooltipText(@Nullable final String tooltipText, final int x, final int y, final int w, final int h)
Sets the tooltip text to show when the mouse is inside this element.the text to show, ornull to disable the tooltip for this element the x coordinate the y coordinate the width the height
void mouseMoved(@NotNull final MouseEvent e)
Will be called when the mouse moves within this component.before. the mouse event relative to this el...
void setIgnore()
Marks this gui element to be ignored for user interaction.
void notifyChanged()
Called whenever the changed flag was set while a GUIElement was visible.
void mousePressed(@NotNull final MouseEvent e)
Will be called when the user has pressed the mouse inside this element.the mouse event relative to th...
boolean pendingChange
Used to avoid refreshing items all the time.