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.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringFire 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_WINDOWFields inherited from class java.awt.Component
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubledoubleintintintintgetValue()doubledoublebooleanbooleanTrue if the tooltip is automatically set from the value and tooltipLabel.voidvoidvoidvoidvoidvoidvoidvoidvoidvoidsetEnabled(boolean b) voidsetKnobLowerColor(Color knobLowerColor) voidsetKnobRadius(double knobRadius) voidsetKnobRectColor(Color knobRectColor) voidsetKnobRectColorDisabled(Color knobRectColorDisabled) voidsetKnobStartAngle(double angle) voidsetKnobUpperColor(Color knobUpperColor) voidsetMaxValue(int maxValue) voidsetMinValue(int minValue) voidsetPadding(int padding) voidsetPanoramicType(boolean panoramicType) voidsetTooltipLabel(String tooltipLabel) If not null and isUseValueTooltip==true, use tooltipLabel to automatically form the tooltip.voidsetUseValueTooltip(boolean useValueTooltip) If true the tooltip is automatically set using the tooltip label (if not null) and the knob value.voidsetValue(int v) voidsetValueLineColor(Color valueLineColor) voidsetValueLineGap(double valueLineGap) voidsetValueLineThickness(double valueLineThickness) Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUIMethods 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, updateMethods 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, validateMethods 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:
getPreferredSizein classJComponent
-
paintComponent
-
setEnabled
public void setEnabled(boolean b) - Overrides:
setEnabledin 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:
mouseDraggedin interfaceMouseMotionListener
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseWheelMoved
- Specified by:
mouseWheelMovedin interfaceMouseWheelListener
-