Package org.apache.pivot.wtk.skin.terra
Class TerraSliderSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ContainerSkin
-
- org.apache.pivot.wtk.skin.SliderSkin
-
- org.apache.pivot.wtk.skin.terra.TerraSliderSkin
-
- All Implemented Interfaces:
ComponentKeyListener,ComponentListener,ComponentMouseButtonListener,ComponentMouseListener,ComponentMouseWheelListener,ComponentStateListener,ComponentTooltipListener,ConstrainedVisual,ContainerListener,ContainerMouseListener,Skin,SliderListener,SliderValueListener,Visual
public class TerraSliderSkin extends SliderSkin
Terra slider skin.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classTerraSliderSkin.ThumbSlider thumb component.protected classTerraSliderSkin.ThumbSkinSlider thumb skin.-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.skin.ContainerSkin
ContainerSkin.IndexFocusTraversalPolicy
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListener
ComponentKeyListener.Adapter, ComponentKeyListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListener
ComponentListener.Adapter, ComponentListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListener
ComponentMouseButtonListener.Adapter, ComponentMouseButtonListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListener
ComponentMouseListener.Adapter, ComponentMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseWheelListener
ComponentMouseWheelListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListener
ComponentStateListener.Adapter, ComponentStateListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentTooltipListener
ComponentTooltipListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerListener
ContainerListener.Adapter, ContainerListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ContainerMouseListener
ContainerMouseListener.Adapter, ContainerMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.SliderListener
SliderListener.Adapter, SliderListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.SliderValueListener
SliderValueListener.Listeners
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_WIDTHstatic intMINIMUM_THUMB_HEIGHTstatic intMINIMUM_THUMB_WIDTH
-
Constructor Summary
Constructors Constructor Description TerraSliderSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.ColorgetButtonBackgroundColor()java.awt.ColorgetButtonBorderColor()intgetPreferredHeight(int width)Returns the visual's preferred height given the provided width constraint.DimensionsgetPreferredSize()Returns the visual's unconstrained preferred size.intgetPreferredWidth(int height)Returns the visual's preferred width given the provided height constraint.intgetThumbHeight()intgetThumbWidth()intgetTickSpacing()java.awt.ColorgetTrackColor()intgetTrackWidth()voidinstall(Component component)Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.voidlayout()If the component on which the skin is installed is a container, lays out the container's children.booleanmouseClick(Component component, Mouse.Button button, int x, int y, int count)Called when a mouse button is clicked over a component.voidorientationChanged(Slider slider)Called when a sliders's orientation has changed.voidpaint(java.awt.Graphics2D graphics)Paints the visual.voidrangeChanged(Slider slider, int previousStart, int previousEnd)Called when a slider's range has changed.voidsetButtonBackgroundColor(int buttonBackgroundColorIndex)voidsetButtonBackgroundColor(java.awt.Color buttonBackgroundColorValue)voidsetButtonBackgroundColor(java.lang.String buttonBackgroundColorString)voidsetButtonBorderColor(int buttonBorderColorIndex)voidsetButtonBorderColor(java.awt.Color buttonBorderColorValue)voidsetButtonBorderColor(java.lang.String buttonBorderColorString)voidsetThumbHeight(int thumbHeightValue)voidsetThumbHeight(java.lang.Number thumbHeightValue)voidsetThumbWidth(int thumbWidthValue)voidsetThumbWidth(java.lang.Number thumbWidthValue)voidsetTickSpacing(int tickSpacingValue)Set the tick spacing value along the slider axis.voidsetTickSpacing(java.lang.Number tickSpacingValue)voidsetTrackColor(int trackColorIndex)voidsetTrackColor(java.awt.Color trackColorValue)voidsetTrackColor(java.lang.String trackColorString)voidsetTrackWidth(int trackWidthValue)voidsetTrackWidth(java.lang.Number trackWidthValue)voidvalueChanged(Slider slider, int previousValue)Called when a slider's value has changed.-
Methods inherited from class org.apache.pivot.wtk.skin.SliderSkin
getSlider
-
Methods inherited from class org.apache.pivot.wtk.skin.ContainerSkin
componentInserted, componentMoved, componentsRemoved, focusTraversalPolicyChanged, getBackgroundColor, getBackgroundPaint, isFocusable, isOpaque, mouseDown, mouseMove, mouseUp, mouseWheel, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundPaint, setBackgroundPaint, setBackgroundPaint
-
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
colorFromObject, colorFromObject, colorFromObject, colorFromObject, currentTheme, cursorChanged, decodeFont, defaultBackgroundColor, defaultForegroundColor, dragSourceChanged, dropTargetChanged, enabledChanged, focusedChanged, fontFromObject, getBaseline, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, keyPressed, keyReleased, keyTyped, locationChanged, menuHandlerChanged, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setDefaultStyles, setSize, sizeChanged, themeHasThickFocusRectangle, themeHasTransitionEnabled, themeIsDark, themeIsFlat, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
setSize
-
-
-
-
Field Detail
-
DEFAULT_WIDTH
public static final int DEFAULT_WIDTH
- See Also:
- Constant Field Values
-
MINIMUM_THUMB_WIDTH
public static final int MINIMUM_THUMB_WIDTH
- See Also:
- Constant Field Values
-
MINIMUM_THUMB_HEIGHT
public static final int MINIMUM_THUMB_HEIGHT
- See Also:
- Constant Field Values
-
-
Method Detail
-
install
public void install(Component component)
Description copied from class:ComponentSkinMust be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.- Specified by:
installin interfaceSkin- Overrides:
installin classSliderSkin- Parameters:
component- The component to which the skin is being attached.
-
getPreferredWidth
public int getPreferredWidth(int height)
Description copied from interface:ConstrainedVisualReturns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidthin interfaceConstrainedVisual- Overrides:
getPreferredWidthin classContainerSkin- Parameters:
height- The height by which to constrain the preferred width, or-1for no constraint.- Returns:
- The preferred width given the height constraint.
-
getPreferredHeight
public int getPreferredHeight(int width)
Description copied from interface:ConstrainedVisualReturns the visual's preferred height given the provided width constraint.- Specified by:
getPreferredHeightin interfaceConstrainedVisual- Overrides:
getPreferredHeightin classContainerSkin- Parameters:
width- The width by which to constrain the preferred height, or-1for no constraint.- Returns:
- The preferred height given the width constraint.
-
getPreferredSize
public Dimensions getPreferredSize()
Description copied from interface:ConstrainedVisualReturns the visual's unconstrained preferred size.- Specified by:
getPreferredSizein interfaceConstrainedVisual- Overrides:
getPreferredSizein classComponentSkin- Returns:
- The preferred size (width and height) of this component.
Depending on the component this can be a static value or derived (as for a container) from its subcomponents, etc.
The default implementation simply calls
ConstrainedVisual.getPreferredWidth(int)andConstrainedVisual.getPreferredHeight(int).
-
layout
public void layout()
Description copied from interface:SkinIf the component on which the skin is installed is a container, lays out the container's children.
-
paint
public void paint(java.awt.Graphics2D graphics)
Description copied from interface:VisualPaints the visual.- Specified by:
paintin interfaceVisual- Overrides:
paintin classContainerSkin- Parameters:
graphics- The graphics context in which to paint the visual.
-
getTrackColor
public java.awt.Color getTrackColor()
-
setTrackColor
public void setTrackColor(java.awt.Color trackColorValue)
-
setTrackColor
public final void setTrackColor(java.lang.String trackColorString)
-
setTrackColor
public final void setTrackColor(int trackColorIndex)
-
getButtonBackgroundColor
public java.awt.Color getButtonBackgroundColor()
-
setButtonBackgroundColor
public void setButtonBackgroundColor(java.awt.Color buttonBackgroundColorValue)
-
setButtonBackgroundColor
public final void setButtonBackgroundColor(java.lang.String buttonBackgroundColorString)
-
setButtonBackgroundColor
public final void setButtonBackgroundColor(int buttonBackgroundColorIndex)
-
getButtonBorderColor
public java.awt.Color getButtonBorderColor()
-
setButtonBorderColor
public void setButtonBorderColor(java.awt.Color buttonBorderColorValue)
-
setButtonBorderColor
public final void setButtonBorderColor(java.lang.String buttonBorderColorString)
-
setButtonBorderColor
public final void setButtonBorderColor(int buttonBorderColorIndex)
-
getTrackWidth
public int getTrackWidth()
-
setTrackWidth
public void setTrackWidth(int trackWidthValue)
-
setTrackWidth
public void setTrackWidth(java.lang.Number trackWidthValue)
-
getThumbWidth
public int getThumbWidth()
-
setThumbWidth
public void setThumbWidth(int thumbWidthValue)
-
setThumbWidth
public void setThumbWidth(java.lang.Number thumbWidthValue)
-
getThumbHeight
public int getThumbHeight()
-
setThumbHeight
public void setThumbHeight(int thumbHeightValue)
-
setThumbHeight
public void setThumbHeight(java.lang.Number thumbHeightValue)
-
getTickSpacing
public int getTickSpacing()
-
setTickSpacing
public void setTickSpacing(int tickSpacingValue)
Set the tick spacing value along the slider axis.- Parameters:
tickSpacingValue- An integer number of pixels to use to space out the tick marks along the axis. Less or equal zero implies don't draw tick marks.
-
setTickSpacing
public void setTickSpacing(java.lang.Number tickSpacingValue)
-
mouseClick
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count)
Description copied from interface:ComponentMouseButtonListenerCalled when a mouse button is clicked over a component.- Specified by:
mouseClickin interfaceComponentMouseButtonListener- Overrides:
mouseClickin classComponentSkin- Parameters:
component- Component user the mouse pointer.button- Which mouse button was clicked.x- X position of the mouse.y- Y position of the mouse.count- Number of clicks (1 = single click, 2 = double click, etc.).- Returns:
trueto consume the event;falseto allow it to propagate (default).
-
rangeChanged
public void rangeChanged(Slider slider, int previousStart, int previousEnd)
Description copied from interface:SliderListenerCalled when a slider's range has changed.- Parameters:
slider- The slider that has changed.previousStart- The previous start of the slider's range.previousEnd- The previous end value.
-
orientationChanged
public void orientationChanged(Slider slider)
Description copied from interface:SliderListenerCalled when a sliders's orientation has changed.- Parameters:
slider- The source of the event.
-
valueChanged
public void valueChanged(Slider slider, int previousValue)
Description copied from interface:SliderValueListenerCalled when a slider's value has changed.- Parameters:
slider- The slider whose value has changed.previousValue- What the previous value was.
-
-