@ColorCodes(value={"action.button","action.button.focus","action.button.enabled","action.button.enabled.focus","action.button.selected","action.button.selected.focus","action.button.selected.enabled","action.button.selected.enabled.focus","action.button.mouse.enabled","action.button.mouse.enabled.focus","action.button.mouse.selected.enabled","action.button.mouse.selected.enabled.focus","action.button.pressed.enabled","action.button.pressed.enabled.focus","action.button.pressed.selected.enabled","action.button.pressed.selected.enabled.focus","action.button.text","action.button.text.enabled","action.button.text.selected","action.button.text.selected.enabled","action.button.text.mouse.enabled","action.button.text.mouse.selected.enabled","action.button.text.pressed.enabled","action.button.text.pressed.selected.enabled"}) public class RoundButton extends JComponent implements RoundButtonConnectable
setController(DockController)
for optimal usage.JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
RoundButton(BasicTrigger trigger,
BasicResourceInitializer initializer,
Dockable dockable,
DockAction action)
Creates a new round button.
|
Modifier and Type | Method and Description |
---|---|
protected void |
animate(String key,
String color)
|
boolean |
contains(int x,
int y) |
protected MiniButtonContent |
createButtonContent()
Creates the component that shows the contents of this button.
|
protected AbstractDockColor |
createColor(String key,
Dockable dockable,
DockAction action,
Color backup)
Creates a new
DockColor representing one color used by this button. |
protected AbstractDockColor[] |
createColors(Dockable dockable,
DockAction action) |
void |
doLayout() |
protected void |
doPaintBackground(Graphics g)
Paints the background of this button.
|
protected void |
doPaintForeground(Graphics g)
Paints the foreground of this button.
|
protected BubbleColorAnimation |
getAnimation()
Access to the
BubbleColorAnimation which is responsible for repainting this button. |
protected MiniButtonContent |
getContent()
Gets the content component of this button.
|
BasicButtonModel |
getModel() |
Dimension |
getPreferredSize() |
boolean |
isPaintFocusBorder()
Tells whether a special border is painted if this button is focused.
|
protected void |
paintComponent(Graphics g) |
void |
setController(DockController controller)
Connects this button with a controller, that is necessary to get the
colors for this button.
|
void |
setPaintFocusBorder(boolean paintFocusBorder)
Sets whether a special border should be painted if this button is focused.
|
protected void |
updateColors()
Reads all
DockColor s of this RoundButton and updates the animation
if necessary. |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, 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, 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, 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, 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, getName, 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, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public RoundButton(BasicTrigger trigger, BasicResourceInitializer initializer, Dockable dockable, DockAction action)
trigger
- a trigger which gets informed when the user clicks the
button.initializer
- a strategy to lazily initialize resources, can be null
dockable
- the dockable for which this button is usedaction
- the action for which this button is usedprotected MiniButtonContent createButtonContent()
protected AbstractDockColor[] createColors(Dockable dockable, DockAction action)
protected AbstractDockColor createColor(String key, Dockable dockable, DockAction action, Color backup)
DockColor
representing one color used by this button.key
- the unique identifier of the colordockable
- the dockable for which the color is used, may be null
action
- the action represented by this button, may be null
backup
- the backup color that is used if no other color was foundDockColor
protected BubbleColorAnimation getAnimation()
BubbleColorAnimation
which is responsible for repainting this button. Subclasses
may use this method to insert or modify custom colors.public void setPaintFocusBorder(boolean paintFocusBorder)
paintFocusBorder
- whether to paint the borderpublic boolean isPaintFocusBorder()
public void setController(DockController controller)
setController
in interface RoundButtonConnectable
controller
- the controller, can be null
public BasicButtonModel getModel()
public boolean contains(int x, int y)
contains
in class JComponent
protected MiniButtonContent getContent()
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
protected void paintComponent(Graphics g)
paintComponent
in class JComponent
protected void doPaintBackground(Graphics g)
g
- the graphics context to useprotected void doPaintForeground(Graphics g)
g
- the graphics context to useprotected void updateColors()
DockColor
s of this RoundButton
and updates the animation
if necessary.protected void animate(String key, String color)
key
- the key of the color in the animationcolor
- the key of the AbstractDockColor