FileDocCategorySizeDatePackage
WindowsSliderUI.javaAPI DocJava SE 5 API4133Fri Aug 26 14:54:50 BST 2005com.sun.java.swing.plaf.windows

WindowsSliderUI

public 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
Constructors Summary
public WindowsSliderUI(JSlider b)

	super(b);
    
Methods Summary
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent b)

        return new WindowsSliderUI((JSlider)b);
    
protected java.awt.DimensiongetThumbSize()

        XPStyle xp = XPStyle.getXP();
	if (xp != null) {
            Dimension size = new Dimension();
            XPStyle.Skin s = getXPThumbSkin();
            size.width = s.getWidth();
            size.height = s.getHeight();
            return size;
	} else {
	    return super.getThumbSize();
	}
    
private XPStyle.SkingetXPThumbSkin()

	XPStyle xp = XPStyle.getXP();
	String category;
        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) {
		category = vertical ? "trackbar.thumbvert"
				    : "trackbar.thumb";
	} else {
		category = vertical ? (leftToRight ? "trackbar.thumbright" : "trackbar.thumbleft")
				    : "trackbar.thumbbottom";
	}
	return xp.getSkin(category);
    
protected voidpaintMajorTickForHorizSlider(java.awt.Graphics g, java.awt.Rectangle tickBounds, int x)

	XPStyle xp = XPStyle.getXP();
	if (xp != null) {
	    g.setColor(xp.getColor("trackbar.tics.color", Color.black));
	}
	super.paintMajorTickForHorizSlider(g, tickBounds, x);
    
protected voidpaintMajorTickForVertSlider(java.awt.Graphics g, java.awt.Rectangle tickBounds, int y)

	XPStyle xp = XPStyle.getXP();
	if (xp != null) {
	    g.setColor(xp.getColor("trackbar.ticsvert.color", Color.black));
	}
	super.paintMajorTickForVertSlider(g, tickBounds, y);
    
protected voidpaintMinorTickForHorizSlider(java.awt.Graphics g, java.awt.Rectangle tickBounds, int x)

	XPStyle xp = XPStyle.getXP();
	if (xp != null) {
	    g.setColor(xp.getColor("trackbar.tics.color", Color.black));
	}
	super.paintMinorTickForHorizSlider(g, tickBounds, x);
    
protected voidpaintMinorTickForVertSlider(java.awt.Graphics g, java.awt.Rectangle tickBounds, int y)

	XPStyle xp = XPStyle.getXP();
	if (xp != null) {
	    g.setColor(xp.getColor("trackbar.ticsvert.color", Color.black));
	}
	super.paintMinorTickForVertSlider(g, tickBounds, y);
    
public voidpaintThumb(java.awt.Graphics g)

        
	XPStyle xp = XPStyle.getXP();
	if (xp != null) {
	    // Pending: Implement all five states
            int index = 0;
            if (!slider.isEnabled()) {
                index = 4;
            }
            getXPThumbSkin().paintSkin(g, thumbRect.x, thumbRect.y, index);
	} else {
	    super.paintThumb(g);
	}
    
public voidpaintTrack(java.awt.Graphics g)

        
	XPStyle xp = XPStyle.getXP();
	if (xp != null) {
	    boolean vertical = (slider.getOrientation() == JSlider.VERTICAL);
	    String category = vertical ? "trackbar.trackvert" : "trackbar.track";
	    XPStyle.Skin skin = xp.getSkin(category);

	    if (vertical) {
		int x = (trackRect.width - skin.getWidth()) / 2;
		skin.paintSkin(g, trackRect.x + x, trackRect.y, skin.getWidth(), trackRect.height, 0);
	    } else {
		int y = (trackRect.height - skin.getHeight()) / 2;
		skin.paintSkin(g, trackRect.x, trackRect.y + y, trackRect.width, skin.getHeight(), 0);
	    }
	} else {
	    super.paintTrack(g);
	}