FileDocCategorySizeDatePackage
MotifSliderUI.javaAPI DocJava SE 5 API4061Fri Aug 26 14:54:48 BST 2005com.sun.java.swing.plaf.motif

MotifSliderUI

public class MotifSliderUI extends BasicSliderUI
Motif Slider

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.

version
1.22 12/19/03
author
Jeff Dinkins

Fields Summary
static final Dimension
PREFERRED_HORIZONTAL_SIZE
static final Dimension
PREFERRED_VERTICAL_SIZE
static final Dimension
MINIMUM_HORIZONTAL_SIZE
static final Dimension
MINIMUM_VERTICAL_SIZE
Constructors Summary
public MotifSliderUI(JSlider b)
MotifSliderUI Constructor


           
         
        super(b);
    
Methods Summary
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent b)
create a MotifSliderUI object

        return new MotifSliderUI((JSlider)b);
    
public java.awt.DimensiongetMinimumHorizontalSize()

        return MINIMUM_HORIZONTAL_SIZE;
    
public java.awt.DimensiongetMinimumVerticalSize()

        return MINIMUM_VERTICAL_SIZE;
    
public java.awt.DimensiongetPreferredHorizontalSize()

        return PREFERRED_HORIZONTAL_SIZE;
    
public java.awt.DimensiongetPreferredVerticalSize()

        return PREFERRED_VERTICAL_SIZE;
    
protected java.awt.DimensiongetThumbSize()

        if ( slider.getOrientation() == JSlider.HORIZONTAL ) {
	    return new Dimension( 30, 15 );
	}
	else {
	    return new Dimension( 15, 30 );
	}
    
public voidpaintFocus(java.awt.Graphics g)

        
    
public voidpaintThumb(java.awt.Graphics g)

        Rectangle knobBounds = thumbRect;

        int x = knobBounds.x;
        int y = knobBounds.y;       
        int w = knobBounds.width;
        int h = knobBounds.height;      

        if ( slider.isEnabled() ) {
            g.setColor(slider.getForeground());
        }
        else {
            // PENDING(jeff) - the thumb should be dithered when disabled
            g.setColor(slider.getForeground().darker());
        }

        if ( slider.getOrientation() == JSlider.HORIZONTAL ) {
            g.translate(x, knobBounds.y-1);

            // fill
            g.fillRect(0, 1, w, h - 1);

            // highlight
            g.setColor(getHighlightColor());
            g.drawLine(0, 1, w - 1, 1);             // top
            g.drawLine(0, 1, 0, h);                     // left
            g.drawLine(w/2, 2, w/2, h-1);       // center

            // shadow
            g.setColor(getShadowColor());
            g.drawLine(0, h, w - 1, h);         // bottom
            g.drawLine(w - 1, 1, w - 1, h);     // right
            g.drawLine(w/2 - 1, 2, w/2 - 1, h); // center

            g.translate(-x, -(knobBounds.y-1));
        }
        else {
            g.translate(knobBounds.x-1, 0);

            // fill
            g.fillRect(1, y, w - 1, h);

            // highlight
            g.setColor(getHighlightColor());
            g.drawLine(1, y, w, y);                     // top
            g.drawLine(1, y+1, 1, y+h-1);               // left
            g.drawLine(2, y+h/2, w-1, y+h/2);           // center

            // shadow
            g.setColor(getShadowColor());
            g.drawLine(2, y+h-1, w, y+h-1);             // bottom
            g.drawLine(w, y+h-1, w, y);                 // right
            g.drawLine(2, y+h/2-1, w-1, y+h/2-1);       // center

            g.translate(-(knobBounds.x-1), 0);
        }
    
public voidpaintTrack(java.awt.Graphics g)