WindowsSliderUIpublic class WindowsSliderUI extends BasicSliderUI Windows rendition of the component.
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. A future release of Swing will provide support for
long term persistence. |
Fields Summary |
---|
private boolean | rollover | private boolean | pressed |
Constructors Summary |
---|
public WindowsSliderUI(JSlider b)
super(b);
|
Methods Summary |
---|
protected TrackListener | createTrackListener(javax.swing.JSlider slider)Overrides to return a private track listener subclass which handles
the HOT, PRESSED, and FOCUSED states.
return new WindowsTrackListener();
| public static javax.swing.plaf.ComponentUI | createUI(javax.swing.JComponent b)
return new WindowsSliderUI((JSlider)b);
| protected java.awt.Dimension | getThumbSize()
XPStyle xp = XPStyle.getXP();
if (xp != null) {
Dimension size = new Dimension();
Skin s = xp.getSkin(slider, getXPThumbPart());
size.width = s.getWidth();
size.height = s.getHeight();
return size;
} else {
return super.getThumbSize();
}
| private Part | getXPThumbPart()
XPStyle xp = XPStyle.getXP();
Part part;
boolean vertical = (slider.getOrientation() == JSlider.VERTICAL);
boolean leftToRight = slider.getComponentOrientation().isLeftToRight();
Boolean paintThumbArrowShape =
(Boolean)slider.getClientProperty("Slider.paintThumbArrowShape");
if ((!slider.getPaintTicks() && paintThumbArrowShape == null) ||
paintThumbArrowShape == Boolean.FALSE) {
part = vertical ? Part.TKP_THUMBVERT
: Part.TKP_THUMB;
} else {
part = vertical ? (leftToRight ? Part.TKP_THUMBRIGHT : Part.TKP_THUMBLEFT)
: Part.TKP_THUMBBOTTOM;
}
return part;
| protected void | paintMajorTickForHorizSlider(java.awt.Graphics g, java.awt.Rectangle tickBounds, int x)
XPStyle xp = XPStyle.getXP();
if (xp != null) {
g.setColor(xp.getColor(slider, Part.TKP_TICS, null, Prop.COLOR, Color.black));
}
super.paintMajorTickForHorizSlider(g, tickBounds, x);
| protected void | paintMajorTickForVertSlider(java.awt.Graphics g, java.awt.Rectangle tickBounds, int y)
XPStyle xp = XPStyle.getXP();
if (xp != null) {
g.setColor(xp.getColor(slider, Part.TKP_TICSVERT, null, Prop.COLOR, Color.black));
}
super.paintMajorTickForVertSlider(g, tickBounds, y);
| protected void | paintMinorTickForHorizSlider(java.awt.Graphics g, java.awt.Rectangle tickBounds, int x)
XPStyle xp = XPStyle.getXP();
if (xp != null) {
g.setColor(xp.getColor(slider, Part.TKP_TICS, null, Prop.COLOR, Color.black));
}
super.paintMinorTickForHorizSlider(g, tickBounds, x);
| protected void | paintMinorTickForVertSlider(java.awt.Graphics g, java.awt.Rectangle tickBounds, int y)
XPStyle xp = XPStyle.getXP();
if (xp != null) {
g.setColor(xp.getColor(slider, Part.TKP_TICSVERT, null, Prop.COLOR, Color.black));
}
super.paintMinorTickForVertSlider(g, tickBounds, y);
| public void | paintThumb(java.awt.Graphics g)
XPStyle xp = XPStyle.getXP();
if (xp != null) {
Part part = getXPThumbPart();
State state = State.NORMAL;
if (slider.hasFocus()) {
state = State.FOCUSED;
}
if (rollover) {
state = State.HOT;
}
if (pressed) {
state = State.PRESSED;
}
if(!slider.isEnabled()) {
state = State.DISABLED;
}
xp.getSkin(slider, part).paintSkin(g, thumbRect.x, thumbRect.y, state);
} else {
super.paintThumb(g);
}
| public void | paintTrack(java.awt.Graphics g)
XPStyle xp = XPStyle.getXP();
if (xp != null) {
boolean vertical = (slider.getOrientation() == JSlider.VERTICAL);
Part part = vertical ? Part.TKP_TRACKVERT : Part.TKP_TRACK;
Skin skin = xp.getSkin(slider, part);
if (vertical) {
int x = (trackRect.width - skin.getWidth()) / 2;
skin.paintSkin(g, trackRect.x + x, trackRect.y,
skin.getWidth(), trackRect.height, null);
} else {
int y = (trackRect.height - skin.getHeight()) / 2;
skin.paintSkin(g, trackRect.x, trackRect.y + y,
trackRect.width, skin.getHeight(), null);
}
} else {
super.paintTrack(g);
}
|
|