22 package com.realtime.crossfire.jxclient.gui.misc;
30 import java.awt.Color;
31 import java.awt.Component;
33 import java.awt.Point;
34 import java.awt.event.MouseEvent;
35 import org.jetbrains.annotations.NotNull;
36 import org.jetbrains.annotations.Nullable;
74 super(tooltipManager, elementListener, name, null, textFont, textColor, backgroundColor,
Alignment.
LEFT, title);
83 super.mousePressed(e);
90 final Point point = e.getLocationOnScreen();
91 offset =
new Point(gui.getX()-point.x, gui.getY()-point.y);
99 super.mouseReleased(e);
109 super.mouseDragged(e);
117 private void moveTo(@NotNull
final MouseEvent e) {
118 final Point tmpOffset =
offset;
119 if (tmpOffset == null) {
129 final Point point = e.getLocationOnScreen();
Listener for GUIElement related events.
static Gui getGui(@NotNull final Component element)
Returns the Gui an element is part of.
A AbstractLabel that renders the text as a plain string.
final JXCWindowRenderer windowRenderer
The JXCWindowRenderer this element belongs to.
Combines a list of GUIElements to for a gui.
Point offset
Set to the distance of the dialog coordinates relative to the mouse position while dragging start...
final TooltipManager tooltipManager
The TooltipManager to update.
final Color textColor
The text color.
final Font textFont
The font for rendering the label text.
void showDialog(final int x, final int y, final int windowWidth, final int windowHeight)
Sets the position of a dialog but makes sure the dialog is fully visible.
final GUIElementListener elementListener
The GUIElementListener to notify.
int getWindowHeight()
Returns the height of the client area.
final Color backgroundColor
If set, the opaque background color.
final String name
The name of this element.
void moveTo(@NotNull final MouseEvent e)
Moves the dialog the given point.
Renders a Gui instance into a Frame.
GUIDialogTitle(@NotNull final TooltipManager tooltipManager, @NotNull final JXCWindowRenderer windowRenderer, @NotNull final GUIElementListener elementListener, @NotNull final String name, @NotNull final Font textFont, @NotNull final Color textColor, @Nullable final Color backgroundColor, @NotNull final String title)
Creates a new instance.
Utility class for Gui related functions.
A dialog title that allows to move the dialog.
boolean isAutoSize()
Returns whether this dialog is an auto-size dialog.
static final long serialVersionUID
The serial version UID.
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
int getWindowWidth()
Returns the width of the client area.
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...
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...