public class

MetalSliderUI

extends BasicSliderUI
java.lang.Object
   ↳ javax.swing.plaf.ComponentUI
     ↳ javax.swing.plaf.SliderUI
       ↳ javax.swing.plaf.basic.BasicSliderUI
         ↳ javax.swing.plaf.metal.MetalSliderUI

Class Overview

A Java L&F implementation of SliderUI.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder.

Summary

Nested Classes
class MetalSliderUI.MetalPropertyListener  
[Expand]
Inherited Constants
From class javax.swing.plaf.basic.BasicSliderUI
Fields
protected final String SLIDER_FILL
protected final int TICK_BUFFER
protected static Color darkShadowColor
protected boolean filledSlider
protected static Color highlightColor
protected static Icon horizThumbIcon A default horizontal thumb Icon.
protected static Color thumbColor
protected static int tickLength
protected static int trackWidth
protected static Icon vertThumbIcon A default vertical thumb Icon.
[Expand]
Inherited Fields
From class javax.swing.plaf.basic.BasicSliderUI
Public Constructors
MetalSliderUI()
Public Methods
static ComponentUI createUI(JComponent c)
int getTickLength()
Gets the height of the tick area for horizontal sliders and the width of the tick area for vertical sliders.
void installUI(JComponent c)
Configures the specified component appropriate for the look and feel.
void paintFocus(Graphics g)
void paintThumb(Graphics g)
void paintTrack(Graphics g)
Protected Methods
PropertyChangeListener createPropertyChangeListener(JSlider slider)
int getThumbOverhang()
Returns the amount that the thumb goes past the slide bar.
Dimension getThumbSize()
int getTrackLength()
Returns the longer dimension of the slide bar.
int getTrackWidth()
Returns the shorter dimension of the track.
void paintMajorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x)
void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds, int y)
void paintMinorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x)
void paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds, int y)
void scrollDueToClickInTrack(int dir)
This function is called when a mousePressed was detected in the track, not in the thumb.
[Expand]
Inherited Methods
From class javax.swing.plaf.basic.BasicSliderUI
From class javax.swing.plaf.ComponentUI
From class java.lang.Object

Fields

protected final String SLIDER_FILL

Constant Value: "JSlider.isFilled"

protected final int TICK_BUFFER

Constant Value: 4 (0x00000004)

protected static Color darkShadowColor

protected boolean filledSlider

protected static Color highlightColor

protected static Icon horizThumbIcon

A default horizontal thumb Icon. This field might not be used. To change the Icon used by this delgate directly set it using the Slider.horizontalThumbIcon UIManager property.

protected static Color thumbColor

protected static int tickLength

protected static int trackWidth

protected static Icon vertThumbIcon

A default vertical thumb Icon. This field might not be used. To change the Icon used by this delgate directly set it using the Slider.verticalThumbIcon UIManager property.

Public Constructors

public MetalSliderUI ()

Public Methods

public static ComponentUI createUI (JComponent c)

public int getTickLength ()

Gets the height of the tick area for horizontal sliders and the width of the tick area for vertical sliders. BasicSliderUI uses the returned value to determine the tick area rectangle.

public void installUI (JComponent c)

Configures the specified component appropriate for the look and feel. This method is invoked when the ComponentUI instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:

  1. Install any default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should not be overridden.
  2. Install a LayoutManager on the component if necessary.
  3. Create/add any required sub-components to the component.
  4. Create/install event listeners on the component.
  5. Create/install a PropertyChangeListener on the component in order to detect and respond to component property changes appropriately.
  6. Install keyboard UI (mnemonics, traversal, etc.) on the component.
  7. Initialize any appropriate instance data.

Parameters
c the component where this UI delegate is being installed

public void paintFocus (Graphics g)

public void paintThumb (Graphics g)

public void paintTrack (Graphics g)

Protected Methods

protected PropertyChangeListener createPropertyChangeListener (JSlider slider)

protected int getThumbOverhang ()

Returns the amount that the thumb goes past the slide bar.

protected Dimension getThumbSize ()

protected int getTrackLength ()

Returns the longer dimension of the slide bar. (The slide bar is only the part that runs directly under the thumb)

protected int getTrackWidth ()

Returns the shorter dimension of the track.

protected void paintMajorTickForHorizSlider (Graphics g, Rectangle tickBounds, int x)

protected void paintMajorTickForVertSlider (Graphics g, Rectangle tickBounds, int y)

protected void paintMinorTickForHorizSlider (Graphics g, Rectangle tickBounds, int x)

protected void paintMinorTickForVertSlider (Graphics g, Rectangle tickBounds, int y)

protected void scrollDueToClickInTrack (int dir)

This function is called when a mousePressed was detected in the track, not in the thumb. The default behavior is to scroll by block. You can override this method to stop it from scrolling or to add additional behavior.