Class AbstractGUIElement
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement
- All Implemented Interfaces:
GUIElement,ImageObserver,MenuContainer,Serializable
- Direct Known Subclasses:
AbstractGUIMap,AbstractLabel,ActivatableGUIElement,GUIComboBox,GUIDialogBackground,GUIDupGauge,GUIFill,GUIGauge,GUILog,GUIMapDirections,GUIPicture,GUIPictureStat
Abstract base class for GUI elements to be shown in
Guis.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractGUIElement(@NotNull TooltipManager tooltipManager, @NotNull GUIElementListener elementListener, @NotNull String name, boolean opaque, @NotNull GuiFactory guiFactory) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Releases all allocated resources.intReturns the size of the dialog's bottom border.intReturns the size of the dialog's left border.intReturns the size of the dialog's right border.intReturns the size of the dialog's top border.@NotNull StringgetName()Returns the internal name of this gui element.abstract @Nullable TooltipTextReturns the current tooltip text.voidPrevents change listeners to be notified.booleanReturns whether this element is the default element.booleanisIgnore()Returns whether this gui element is to be ignored for user interaction.voidmouseClicked(@NotNull MouseEvent e) Will be called when the user has clicked (pressed+released) this element.voidmouseDragged(@NotNull MouseEvent e) Will be called when the mouse moves within this component while the button is pressed.voidmouseEntered(@NotNull MouseEvent e) Will be called when the mouse has entered the bounding box of this element.voidmouseExited(@NotNull MouseEvent e) Will be called when the mouse has left the bounding box of this element.voidmouseMoved(@NotNull MouseEvent e) Will be called when the mouse moves within this component.voidmousePressed(@NotNull MouseEvent e) Will be called when the user has pressed the mouse inside this element.voidmouseReleased(@NotNull MouseEvent e) Will be called when the user has released the mouse.voidmouseWheelMoved(int wheelRotation) Will be called when the mouse wheel has been moved.protected @Nullable TooltipTextnewTooltipText(@Nullable String tooltipText) Creates aTooltipTextinstance relative to this instance.voidRecords that the contents have changed and must be repainted.voidsetChangedListener(@Nullable GUIElementChangedListener changedListener) Sets theGUIElementChangedListenerto be notified.voidsetDefault(boolean isDefault) Sets whether this element is the default element.voidMarks this gui element to be ignored for user interaction.protected voidMust be called whenever thetooltipmay have changed.@NotNull StringtoString()Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUIMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.realtime.crossfire.jxclient.gui.gui.GUIElement
notifyOpen
-
Constructor Details
-
AbstractGUIElement
protected AbstractGUIElement(@NotNull @NotNull TooltipManager tooltipManager, @NotNull @NotNull GUIElementListener elementListener, @NotNull @NotNull String name, boolean opaque, @NotNull @NotNull GuiFactory guiFactory) Creates a new instance.- Parameters:
tooltipManager- the tooltip manager to updateelementListener- the element listener to notifyname- the name of this elementopaque- whether this element is opaqueguiFactory- the global GUI factory instance
-
-
Method Details
-
dispose
public void dispose()Description copied from interface:GUIElementReleases all allocated resources.- Specified by:
disposein interfaceGUIElement
-
toString
-
isDefault
public boolean isDefault()Description copied from interface:GUIElementReturns whether this element is the default element. The default element is selected with the ENTER key.- Specified by:
isDefaultin interfaceGUIElement- Returns:
- whether this element is the default element
-
setDefault
public void setDefault(boolean isDefault) Description copied from interface:GUIElementSets whether this element is the default element. The default element is selected with the ENTER key.- Specified by:
setDefaultin interfaceGUIElement- Parameters:
isDefault- whether this element is the default element
-
setIgnore
public void setIgnore()Description copied from interface:GUIElementMarks this gui element to be ignored for user interaction.- Specified by:
setIgnorein interfaceGUIElement
-
isIgnore
public boolean isIgnore()Description copied from interface:GUIElementReturns whether this gui element is to be ignored for user interaction.- Specified by:
isIgnorein interfaceGUIElement- Returns:
- whether this gui element is ignored
-
getName
Description copied from interface:GUIElementReturns the internal name of this gui element. The name is used in skin files for identifying an element.- Specified by:
getNamein interfaceGUIElement- Overrides:
getNamein classComponent- Returns:
- the name
-
mouseClicked
Description copied from interface:GUIElementWill be called when the user has clicked (pressed+released) this element. This event will be delivered afterGUIElement.mouseReleased(MouseEvent).- Specified by:
mouseClickedin interfaceGUIElement- Parameters:
e- the mouse event relative to this element
-
mouseEntered
Description copied from interface:GUIElementWill be called when the mouse has entered the bounding box of this element.- Specified by:
mouseEnteredin interfaceGUIElement- Parameters:
e- the mouse event relative to this element
-
mouseExited
Description copied from interface:GUIElementWill be called when the mouse has left the bounding box of this element. This function will not be called unlessGUIElement.mouseEntered(MouseEvent)has been called before.- Specified by:
mouseExitedin interfaceGUIElement- Parameters:
e- the mouse event relative to this element
-
mousePressed
Description copied from interface:GUIElementWill be called when the user has pressed the mouse inside this element.- Specified by:
mousePressedin interfaceGUIElement- Parameters:
e- the mouse event relative to this element
-
mouseReleased
Description copied from interface:GUIElementWill be called when the user has released the mouse. This event may be delivered even if no previousGUIElement.mousePressed(MouseEvent)has been delivered before.- Specified by:
mouseReleasedin interfaceGUIElement- Parameters:
e- the mouse event relative to this element
-
mouseMoved
Description copied from interface:GUIElementWill be called when the mouse moves within this component. before.- Specified by:
mouseMovedin interfaceGUIElement- Parameters:
e- the mouse event relative to this element
-
mouseDragged
Description copied from interface:GUIElementWill be called when the mouse moves within this component while the button is pressed. This event will be delivered afterGUIElement.mouseMoved(MouseEvent).Note: if the mouse leaves this element's bounding box while the mouse button is still pressed, further
mouseDragged(but nomouseMoved) events will be generated.- Specified by:
mouseDraggedin interfaceGUIElement- Parameters:
e- the mouse event relative to this element
-
mouseWheelMoved
public void mouseWheelMoved(int wheelRotation) Description copied from interface:GUIElementWill be called when the mouse wheel has been moved.- Specified by:
mouseWheelMovedin interfaceGUIElement- Parameters:
wheelRotation- the movement amount; negative=away from the user, positive=towards the user
-
setChanged
public void setChanged()Description copied from interface:GUIElementRecords that the contents have changed and must be repainted.- Specified by:
setChangedin interfaceGUIElement
-
getTooltip
Returns the current tooltip text.- Returns:
- the tooltip text or
nullto not show a tooltip
-
newTooltipText
Creates aTooltipTextinstance relative to this instance.- Parameters:
tooltipText- the text of the instance ornullto returnnull- Returns:
- the new instance or
nullif this component is not in a GUI
-
tooltipChanged
protected void tooltipChanged()Must be called whenever thetooltipmay have changed. -
setChangedListener
Description copied from interface:GUIElementSets theGUIElementChangedListenerto be notified. Note that at most one such listener may be set per gui element.- Specified by:
setChangedListenerin interfaceGUIElement- Parameters:
changedListener- the listener ornullto unset
-
inhibitListeners
public void inhibitListeners()Prevents change listeners to be notified. -
getDialogBorderTop
public int getDialogBorderTop()Returns the size of the dialog's top border.- Returns:
- the size in pixels or 0 if this GUI element is not a dialog
-
getDialogBorderLeft
public int getDialogBorderLeft()Returns the size of the dialog's left border.- Returns:
- the size in pixels or 0 if this GUI element is not a dialog
-
getDialogBorderRight
public int getDialogBorderRight()Returns the size of the dialog's right border.- Returns:
- the size in pixels or 0 if this GUI element is not a dialog
-
getDialogBorderBottom
public int getDialogBorderBottom()Returns the size of the dialog's bottom border.- Returns:
- the size in pixels or 0 if this GUI element is not a dialog
-