public abstract class AbstractButton extends ActivatableGUIElement implements KeyPressedHandler
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
private boolean |
autoRepeat
Whether this button should autorepeat.
|
private CommandList |
commandList
The commands to execute when the button is elected.
|
private static long |
serialVersionUID
The serial version UID.
|
private static int |
TIMEOUT_FIRST
The autorepeat delay initially.
|
private static int |
TIMEOUT_SECOND
The autorepeat delay for further repeats.
|
private java.awt.event.ActionListener |
timeoutEvent
The
ActionListener for generating autorepeat events. |
private javax.swing.Timer |
timer
The
Timer for auto-repeating buttons. |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Modifier | Constructor and Description |
---|---|
protected |
AbstractButton(TooltipManager tooltipManager,
GUIElementListener elementListener,
java.lang.String name,
int transparency,
boolean autoRepeat,
CommandList commandList)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
execute()
Executes the actions associated with this GUI element.
|
java.awt.Dimension |
getMinimumSize() |
protected abstract java.awt.Dimension |
getMinimumSizeInt()
Returns the minimal size needed to display this component.
|
java.awt.Dimension |
getPreferredSize() |
boolean |
keyPressed(KeyEvent2 e)
Invoked when a key has been pressed.
|
void |
mouseClicked(java.awt.event.MouseEvent e)
Will be called when the user has clicked (pressed+released) this element.
|
void |
mouseExited(java.awt.event.MouseEvent e)
Will be called when the mouse has left the bounding box of this element.
|
void |
mousePressed(java.awt.event.MouseEvent e)
Will be called when the user has pressed the mouse inside this element.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Will be called when the user has released the mouse.
|
activeChanged, isActive, markInactivePending, setActive, setInactiveIfPending
dispose, getName, hasTooltipText, isDefault, isIgnore, mouseDragged, mouseEntered, mouseMoved, setChanged, setChangedListener, setDefault, setIgnore, setTooltipText, setTooltipText, toString
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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, 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, updateUI
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, validateTree
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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
private final boolean autoRepeat
@NotNull private final CommandList commandList
private static final long serialVersionUID
private static final int TIMEOUT_FIRST
private static final int TIMEOUT_SECOND
@NotNull private final java.awt.event.ActionListener timeoutEvent
ActionListener
for generating autorepeat events.@NotNull private final javax.swing.Timer timer
Timer
for auto-repeating buttons.protected AbstractButton(@NotNull TooltipManager tooltipManager, @NotNull GUIElementListener elementListener, @NotNull java.lang.String name, int transparency, boolean autoRepeat, @NotNull CommandList commandList)
tooltipManager
- the tooltip manager to updateelementListener
- the element listener to notifyname
- the name of this elementtransparency
- the transparency value for the backing bufferautoRepeat
- whether the button should autorepeat while being
pressedcommandList
- the commands to execute when the button is electedpublic void execute()
execute
in class ActivatableGUIElement
@Nullable public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
@NotNull protected abstract java.awt.Dimension getMinimumSizeInt()
@Nullable public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public boolean keyPressed(@NotNull KeyEvent2 e)
keyPressed
in interface KeyPressedHandler
e
- the key event for the keypublic void mouseClicked(@NotNull java.awt.event.MouseEvent e)
GUIElement.mouseReleased(MouseEvent)
.mouseClicked
in interface GUIElement
mouseClicked
in class AbstractGUIElement
e
- the mouse event relative to this elementpublic void mouseExited(@NotNull java.awt.event.MouseEvent e)
GUIElement.mouseEntered(MouseEvent,
boolean)
has been called before.mouseExited
in interface GUIElement
mouseExited
in class AbstractGUIElement
e
- the mouse event relative to this elementpublic void mousePressed(@NotNull java.awt.event.MouseEvent e)
mousePressed
in interface GUIElement
mousePressed
in class ActivatableGUIElement
e
- the mouse event relative to this elementpublic void mouseReleased(@NotNull java.awt.event.MouseEvent e)
GUIElement.mousePressed(MouseEvent)
has been
delivered before.mouseReleased
in interface GUIElement
mouseReleased
in class AbstractGUIElement
e
- the mouse event relative to this element