public class ButtonBase
extends javax.swing.JComponent
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener, java.awt.event.FocusListener
javax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description |
|---|---|
java.util.function.Function<com.mindfusion.common.Pair<ButtonBase,java.awt.event.InputEvent>,java.lang.Void> |
down
Invoked when the mouse is pressed over the button.
|
java.util.function.Function<com.mindfusion.common.Pair<ButtonBase,java.awt.Graphics>,java.lang.Void> |
draw
Invoked when the button is being painted.
|
java.util.function.Function<com.mindfusion.common.Pair<ButtonBase,java.awt.event.InputEvent>,java.lang.Void> |
up
Invoked when the mouse is pressed over the button.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Modifier | Constructor and Description |
|---|---|
protected |
ButtonBase()
Initializes a new instance of the ButtonBase class.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
drawFocus(java.awt.Graphics e,
int focusPadding) |
void |
focusGained(java.awt.event.FocusEvent e) |
void |
focusLost(java.awt.event.FocusEvent e) |
Brush |
getBackgroundBrush()
Gets the brush used to fill the button when it is in normal state.
|
Brush |
getBackgroundBrushDisabled()
Gets the brush used to fill the button when it is disabled.
|
Brush |
getBackgroundBrushDown()
Gets the brush used to fill the button when it is pressed down.
|
Brush |
getBackgroundBrushOver()
Gets the brush used to fill the button in hovered state.
|
Brush |
getBorderBrush()
Gets the brush used to draw the button border.
|
Brush |
getBorderBrushDisabled()
Gets the brush used to draw borders when the button is disabled.
|
Brush |
getBorderBrushDown()
Gets the brush used to draw borders when the button is pressed down.
|
Brush |
getBorderBrushOver()
Gets the brush used to draw the button border when the button is in hovered state.
|
int |
getBorderThickness()
Gets the thickness of button borders.
|
CustomDraw |
getCustomDraw()
Gets the type of custom drawing for the button.
|
protected Brush |
getEffectiveBackgroundBrush() |
protected Brush |
getEffectiveBorderBrush() |
protected Brush |
getEffectiveForegroundBrush() |
boolean |
getFocusOnClick()
Gets whether the button receives the input focus when clicked.
|
java.awt.Font |
getFont() |
Brush |
getForegroundBrush()
Gets the brush used to draw button's contents.
|
Brush |
getForegroundBrushDisabled()
Gets the brush used to draw button's contents when the button is disabled.
|
Brush |
getForegroundBrushDown()
Gets the brush used to draw button's contents when the button is pressed down.
|
Brush |
getForegroundBrushOver()
Gets the brush used to draw button's contents in hovered state.
|
boolean |
getShowFocus()
Gets whether a focus rectangle should be drawn when the button has input focus.
|
protected com.mindfusion.ui.ButtonBase.ButtonState |
getState() |
java.lang.String |
getText()
Gets the caption displayed by the button.
|
TextAlignment |
getTextAlign()
Gets the alignment of the text in the button control.
|
protected static java.awt.Point |
getTextPositionWithinRect(java.awt.Graphics e,
java.lang.String text,
java.awt.Rectangle rect,
java.awt.Font font,
TextAlignment textAlign) |
void |
keyPressed(java.awt.event.KeyEvent keyData) |
void |
keyReleased(java.awt.event.KeyEvent e) |
void |
keyTyped(java.awt.event.KeyEvent e) |
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
protected void |
onDown(java.awt.event.InputEvent e) |
protected void |
onDraw(java.awt.Graphics e) |
protected void |
onUp(java.awt.event.InputEvent e) |
void |
paint(java.awt.Graphics e) |
void |
setBackgroundBrush(Brush value)
Sets the brush used to fill the button when it is in normal state.
|
void |
setBackgroundBrushDisabled(Brush value)
Sets the brush used to fill the button when it is disabled.
|
void |
setBackgroundBrushDown(Brush value)
Sets the brush used to fill the button when it is pressed down.
|
void |
setBackgroundBrushOver(Brush value)
Sets the brush used to fill the button in hovered state.
|
void |
setBorderBrush(Brush value)
Sets the brush used to draw the button border.
|
void |
setBorderBrushDisabled(Brush value)
Sets the brush used to draw borders when the button is disabled.
|
void |
setBorderBrushDown(Brush value)
Sets the brush used to draw borders when the button is pressed down.
|
void |
setBorderBrushOver(Brush value)
Sets the brush used to draw the button border when the button is in hovered state.
|
void |
setBorderThickness(int value)
Sets the thickness of button borders.
|
void |
setCustomDraw(CustomDraw value)
Sets the type of custom drawing for the button.
|
void |
setFocusOnClick(boolean value)
Sets whether the button receives the input focus when clicked.
|
void |
setFont(java.awt.Font value) |
void |
setForegroundBrush(Brush value)
Sets the brush used to draw button's contents.
|
void |
setForegroundBrushDisabled(Brush value)
Sets the brush used to draw button's contents when the button is disabled.
|
void |
setForegroundBrushDown(Brush value)
Sets the brush used to draw button's contents when the button is pressed down.
|
void |
setForegroundBrushOver(Brush value)
Sets the brush used to draw button's contents in hovered state.
|
void |
setHeight(int height) |
void |
setShowFocus(boolean value)
Sets whether a focus rectangle should be drawn when the button has input focus.
|
void |
setText(java.lang.String value)
Sets the caption displayed by the button.
|
void |
setTextAlign(TextAlignment value)
Sets the alignment of the text in the button control.
|
void |
setWidth(int width) |
void |
setX(int x) |
void |
setY(int y) |
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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUIadd, 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, validateTreeaction, 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, 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, transferFocusUpCyclepublic java.util.function.Function<com.mindfusion.common.Pair<ButtonBase,java.awt.Graphics>,java.lang.Void> draw
public java.util.function.Function<com.mindfusion.common.Pair<ButtonBase,java.awt.event.InputEvent>,java.lang.Void> down
public java.util.function.Function<com.mindfusion.common.Pair<ButtonBase,java.awt.event.InputEvent>,java.lang.Void> up
protected ButtonBase()
protected static java.awt.Point getTextPositionWithinRect(java.awt.Graphics e,
java.lang.String text,
java.awt.Rectangle rect,
java.awt.Font font,
TextAlignment textAlign)
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void setX(int x)
public void setY(int y)
public void setWidth(int width)
public void setHeight(int height)
protected Brush getEffectiveBorderBrush()
protected Brush getEffectiveBackgroundBrush()
protected Brush getEffectiveForegroundBrush()
public void focusGained(java.awt.event.FocusEvent e)
focusGained in interface java.awt.event.FocusListenerpublic void focusLost(java.awt.event.FocusEvent e)
focusLost in interface java.awt.event.FocusListenerpublic void keyPressed(java.awt.event.KeyEvent keyData)
keyPressed in interface java.awt.event.KeyListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void paint(java.awt.Graphics e)
paint in class javax.swing.JComponentprotected void drawFocus(java.awt.Graphics e,
int focusPadding)
protected void onDraw(java.awt.Graphics e)
protected void onDown(java.awt.event.InputEvent e)
protected void onUp(java.awt.event.InputEvent e)
public Brush getBorderBrush()
public void setBorderBrush(Brush value)
value - A Brush instance.public Brush getBorderBrushOver()
public void setBorderBrushOver(Brush value)
value - A Brush instance.public Brush getBorderBrushDown()
public void setBorderBrushDown(Brush value)
value - A Brush instance.public Brush getBorderBrushDisabled()
public void setBorderBrushDisabled(Brush value)
value - A Brush instance.public int getBorderThickness()
public void setBorderThickness(int value)
value - An integer value specifying thickness.public Brush getBackgroundBrush()
public void setBackgroundBrush(Brush value)
value - A Brush instance.public Brush getBackgroundBrushOver()
public void setBackgroundBrushOver(Brush value)
value - A Brush instance.public Brush getBackgroundBrushDown()
public void setBackgroundBrushDown(Brush value)
value - A Brush instance.public Brush getBackgroundBrushDisabled()
public void setBackgroundBrushDisabled(Brush value)
value - A Brush instance.public Brush getForegroundBrush()
public void setForegroundBrush(Brush value)
value - A Brush instance.public Brush getForegroundBrushOver()
public void setForegroundBrushOver(Brush value)
value - A Brush instance.public Brush getForegroundBrushDown()
public void setForegroundBrushDown(Brush value)
value - A Brush instance.public Brush getForegroundBrushDisabled()
public void setForegroundBrushDisabled(Brush value)
value - A Brush instance.public TextAlignment getTextAlign()
public void setTextAlign(TextAlignment value)
value - A member of the TextAlignment enumeration.public CustomDraw getCustomDraw()
public void setCustomDraw(CustomDraw value)
value - A member of the CustomDraw enumeration.public boolean getShowFocus()
public void setShowFocus(boolean value)
value - true to draw focus rectangle, or false otherwise.public boolean getFocusOnClick()
public void setFocusOnClick(boolean value)
value - true to request keyboard focus, or false otherwise.protected com.mindfusion.ui.ButtonBase.ButtonState getState()
public java.awt.Font getFont()
getFont in interface java.awt.MenuContainergetFont in class java.awt.Componentpublic void setFont(java.awt.Font value)
setFont in class javax.swing.JComponentpublic java.lang.String getText()
public void setText(java.lang.String value)
value - A String containing button's caption.public void keyTyped(java.awt.event.KeyEvent e)
keyTyped in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent e)
keyReleased in interface java.awt.event.KeyListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListener