Package org.jjazz.flatcomponents.api
Class FlatIntegerKnob
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.jjazz.flatcomponents.api.FlatIntegerKnob
- All Implemented Interfaces:
MouseListener
,MouseMotionListener
,MouseWheelListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
public class FlatIntegerKnob
extends JPanel
implements MouseMotionListener, MouseWheelListener, MouseListener
A flat knob.
Value can be changed by dragging mouse or mouse wheel. ctrl-click reset the value. Whatever the actual component size, the drawing is done at preferred size.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Fire a PROP_Value property change event when user changes the value.Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
double
int
int
int
int
getValue()
double
double
boolean
boolean
True if the tooltip is automatically set from the value and tooltipLabel.void
void
void
void
void
void
void
void
void
void
setEnabled
(boolean b) void
setKnobLowerColor
(Color knobLowerColor) void
setKnobRadius
(double knobRadius) void
setKnobRectColor
(Color knobRectColor) void
setKnobRectColorDisabled
(Color knobRectColorDisabled) void
setKnobStartAngle
(double angle) void
setKnobUpperColor
(Color knobUpperColor) void
setMaxValue
(int maxValue) void
setMinValue
(int minValue) void
setPadding
(int padding) void
setPanoramicType
(boolean panoramicType) void
setTooltipLabel
(String tooltipLabel) If not null and isUseValueTooltip==true, use tooltipLabel to automatically form the tooltip.void
setUseValueTooltip
(boolean useValueTooltip) If true the tooltip is automatically set using the tooltip label (if not null) and the knob value.void
setValue
(int v) void
setValueLineColor
(Color valueLineColor) void
setValueLineGap
(double valueLineGap) void
setValueLineThickness
(double valueLineThickness) Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
PROP_VALUE
Fire a PROP_Value property change event when user changes the value.- See Also:
-
-
Constructor Details
-
FlatIntegerKnob
public FlatIntegerKnob()
-
-
Method Details
-
getPreferredSize
- Overrides:
getPreferredSize
in classJComponent
-
paintComponent
-
setEnabled
public void setEnabled(boolean b) - Overrides:
setEnabled
in classJComponent
-
getValueLineColor
- Returns:
- the valueLineColor
-
setValueLineColor
- Parameters:
valueLineColor
- the valueLineColor to set
-
getValueLineThickness
public double getValueLineThickness()- Returns:
- the valueLineThickness
-
setValueLineThickness
public void setValueLineThickness(double valueLineThickness) - Parameters:
valueLineThickness
- the valueLineThickness to set
-
getMinValue
public int getMinValue()- Returns:
- the minValue
-
setMinValue
public void setMinValue(int minValue) - Parameters:
minValue
- the minValue to set
-
getMaxValue
public int getMaxValue()- Returns:
- the maxValue
-
setMaxValue
public void setMaxValue(int maxValue) - Parameters:
maxValue
- the maxValue to set
-
getTooltipLabel
-
setTooltipLabel
If not null and isUseValueTooltip==true, use tooltipLabel to automatically form the tooltip.- Parameters:
tooltipLabel
-- See Also:
-
isUseValueTooltip
public boolean isUseValueTooltip()True if the tooltip is automatically set from the value and tooltipLabel.- Returns:
- True by default.
- See Also:
-
setUseValueTooltip
public void setUseValueTooltip(boolean useValueTooltip) If true the tooltip is automatically set using the tooltip label (if not null) and the knob value.- Parameters:
useValueTooltip
-- See Also:
-
setValue
public void setValue(int v) -
getValue
public int getValue() -
getKnobRadius
public double getKnobRadius()- Returns:
- the knobRadius
-
setKnobRadius
public void setKnobRadius(double knobRadius) - Parameters:
knobRadius
- the knobRadius to set
-
getKnobStartAngle
public double getKnobStartAngle()- Returns:
- the knobStartAngle
-
setKnobStartAngle
public void setKnobStartAngle(double angle) - Parameters:
angle
- Between 180 and 270 degrees.
-
getKnobUpperColor
- Returns:
- the knobUpperColor
-
setKnobUpperColor
- Parameters:
knobUpperColor
- the knobUpperColor to set
-
getKnobLowerColor
- Returns:
- the knobLowerColor
-
setKnobLowerColor
- Parameters:
knobLowerColor
- the knobLowerColor to set
-
getValueLineGap
public double getValueLineGap()- Returns:
- the valueLineGap
-
setValueLineGap
public void setValueLineGap(double valueLineGap) - Parameters:
valueLineGap
- the valueLineGap to set
-
getKnobRectColor
- Returns:
- the knobRectColor
-
setKnobRectColor
- Parameters:
knobRectColor
- the knobRectColor to set
-
getPadding
public int getPadding()- Returns:
- the padding
-
setPadding
public void setPadding(int padding) - Parameters:
padding
- the padding to set
-
getKnobRectColorDisabled
- Returns:
- the knobRectColorDisabled
-
setKnobRectColorDisabled
- Parameters:
knobRectColorDisabled
- the knobRectColorDisabled to set
-
isPanoramicType
public boolean isPanoramicType()- Returns:
- the panoramicType. Default is false.
-
setPanoramicType
public void setPanoramicType(boolean panoramicType) - Parameters:
panoramicType
- the panoramicType to set
-
mouseDragged
- Specified by:
mouseDragged
in interfaceMouseMotionListener
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
-
mouseClicked
- Specified by:
mouseClicked
in interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
-
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
-
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
-
mouseWheelMoved
- Specified by:
mouseWheelMoved
in interfaceMouseWheelListener
-