1 |
/* JSlider.java -- |
/* JSlider.java -- |
2 |
Copyright (C) 2002, 2004 Free Software Foundation, Inc. |
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
38 |
|
|
39 |
package javax.swing; |
package javax.swing; |
40 |
|
|
41 |
import java.awt.Dimension; |
import java.awt.Dimension; |
55 |
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
56 |
import javax.swing.plaf.SliderUI; |
import javax.swing.plaf.SliderUI; |
57 |
|
|
|
|
|
58 |
/** |
/** |
|
* <p> |
|
59 |
* The JSlider is a Swing component that allows selection of a value within a |
* The JSlider is a Swing component that allows selection of a value within a |
60 |
* range by adjusting a thumb in a track. The values for the minimum, |
* range by adjusting a thumb in a track. The values for the minimum, |
61 |
* maximum, extent and value are stored in a {@link |
* maximum, extent and value are stored in a {@link |
62 |
* DefaultBoundedRangeModel}. |
* DefaultBoundedRangeModel}. |
|
* </p> |
|
63 |
* |
* |
64 |
* <p> |
* <p> |
65 |
* JSliders have the following properties: |
* JSliders have the following properties: |
204 |
} |
} |
205 |
} |
} |
206 |
|
|
|
/** Fired in a PropertyChangeEvent when the "inverted" property changes. */ |
|
|
public static final String INVERTED_CHANGED_PROPERTY = "inverted"; |
|
|
|
|
|
/** Fired in a PropertyChangeEvent when the "labelTable" property changes. */ |
|
|
public static final String LABEL_TABLE_CHANGED_PROPERTY = "labelTable"; |
|
|
|
|
|
/** |
|
|
* Fired in a PropertyChangeEvent when the "majorTickSpacing" property |
|
|
* changes. |
|
|
*/ |
|
|
public static final String MAJOR_TICK_SPACING_CHANGED_PROPERTY = "majorTickSpacing"; |
|
|
|
|
|
/** |
|
|
* Fired in a PropertyChangeEvent when the "minorTickSpacing" property |
|
|
* changes. |
|
|
*/ |
|
|
public static final String MINOR_TICK_SPACING_CHANGED_PROPERTY = "minorTickSpacing"; |
|
|
|
|
|
/** Fired in a PropertyChangeEvent when the "model" property changes. */ |
|
|
public static final String MODEL_CHANGED_PROPERTY = "model"; |
|
|
|
|
|
/** Fired in a PropertyChangeEvent when the "orientation" property changes. */ |
|
|
public static final String ORIENTATION_CHANGED_PROPERTY = "orientation"; |
|
|
|
|
|
/** Fired in a PropertyChangeEvent when the "paintLabels" property changes. */ |
|
|
public static final String PAINT_LABELS_CHANGED_PROPERTY = "paintLabels"; |
|
|
|
|
|
/** Fired in a PropertyChangeEvent when the "paintTicks" property changes. */ |
|
|
public static final String PAINT_TICKS_CHANGED_PROPERTY = "paintTicks"; |
|
|
|
|
207 |
/** Whether or not this slider paints its ticks. */ |
/** Whether or not this slider paints its ticks. */ |
208 |
private transient boolean paintTicks = false; |
private transient boolean paintTicks = false; |
209 |
|
|
483 |
sliderModel = model; |
sliderModel = model; |
484 |
oldModel.removeChangeListener(changeListener); |
oldModel.removeChangeListener(changeListener); |
485 |
sliderModel.addChangeListener(changeListener); |
sliderModel.addChangeListener(changeListener); |
486 |
firePropertyChange(MODEL_CHANGED_PROPERTY, oldModel, sliderModel); |
firePropertyChange("model", oldModel, sliderModel); |
487 |
} |
} |
488 |
} |
} |
489 |
|
|
592 |
{ |
{ |
593 |
int oldOrientation = this.orientation; |
int oldOrientation = this.orientation; |
594 |
this.orientation = orientation; |
this.orientation = orientation; |
595 |
firePropertyChange(ORIENTATION_CHANGED_PROPERTY, oldOrientation, |
firePropertyChange("orientation", oldOrientation, |
596 |
this.orientation); |
this.orientation); |
597 |
} |
} |
598 |
} |
} |
618 |
{ |
{ |
619 |
Dictionary oldTable = labelTable; |
Dictionary oldTable = labelTable; |
620 |
labelTable = table; |
labelTable = table; |
621 |
firePropertyChange(LABEL_TABLE_CHANGED_PROPERTY, oldTable, labelTable); |
firePropertyChange("labelTable", oldTable, labelTable); |
622 |
} |
} |
623 |
} |
} |
624 |
|
|
719 |
{ |
{ |
720 |
boolean oldInverted = isInverted; |
boolean oldInverted = isInverted; |
721 |
isInverted = inverted; |
isInverted = inverted; |
722 |
firePropertyChange(INVERTED_CHANGED_PROPERTY, oldInverted, isInverted); |
firePropertyChange("inverted", oldInverted, isInverted); |
723 |
} |
} |
724 |
} |
} |
725 |
|
|
745 |
{ |
{ |
746 |
int oldSpacing = majorTickSpacing; |
int oldSpacing = majorTickSpacing; |
747 |
majorTickSpacing = spacing; |
majorTickSpacing = spacing; |
748 |
firePropertyChange(MAJOR_TICK_SPACING_CHANGED_PROPERTY, oldSpacing, |
firePropertyChange("majorTickSpacing", oldSpacing, |
749 |
majorTickSpacing); |
majorTickSpacing); |
750 |
} |
} |
751 |
} |
} |
772 |
{ |
{ |
773 |
int oldSpacing = minorTickSpacing; |
int oldSpacing = minorTickSpacing; |
774 |
minorTickSpacing = spacing; |
minorTickSpacing = spacing; |
775 |
firePropertyChange(MINOR_TICK_SPACING_CHANGED_PROPERTY, oldSpacing, |
firePropertyChange("minorTickSpacing", oldSpacing, |
776 |
minorTickSpacing); |
minorTickSpacing); |
777 |
} |
} |
778 |
} |
} |
832 |
{ |
{ |
833 |
boolean oldPaintTicks = paintTicks; |
boolean oldPaintTicks = paintTicks; |
834 |
paintTicks = paint; |
paintTicks = paint; |
835 |
firePropertyChange(PAINT_TICKS_CHANGED_PROPERTY, oldPaintTicks, |
firePropertyChange("paintTicks", oldPaintTicks, paintTicks); |
|
paintTicks); |
|
836 |
} |
} |
837 |
} |
} |
838 |
|
|
877 |
{ |
{ |
878 |
boolean oldPaintLabels = paintLabels; |
boolean oldPaintLabels = paintLabels; |
879 |
paintLabels = paint; |
paintLabels = paint; |
880 |
firePropertyChange(PAINT_LABELS_CHANGED_PROPERTY, oldPaintLabels, |
firePropertyChange("paintLabels", oldPaintLabels, paintLabels); |
|
paintLabels); |
|
881 |
} |
} |
882 |
} |
} |
883 |
|
|