JSlider.
| Modifier and Type | Class and Description |
|---|---|
| private class | SynthSliderUI.
Track mouse movements. |
| Modifier and Type | Field and Description |
|---|---|
| private Dimension | lastSize
When a JSlider is used as a renderer in a JTable, its layout is not being recomputed even though the size is changing. |
| private boolean | |
| private SynthStyle | |
| private SynthStyle | |
| private SynthStyle | |
| private transient boolean | thumbActive
Used to determine the color to paint the thumb. |
| private int | |
| private transient boolean | |
| private int | |
| private int | |
| private int | |
| private Rectangle |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected void | calculateGeometry()
Overrides javax. Calculates the geometry. |
| protected void | calculateThumbLocation()
Overrides javax. Calculates the thumb location. |
| protected BasicSliderUI. | createTrackListener(JSlider s)
Overrides javax. Creates a track listener. |
| public static ComponentUI | Returns: the UI objectcomponent to create UI object for c)Hides javax. Creates a new UI object for the given component. |
| public int | getBaseline(JComponent c, int width, int height)
Overrides javax. Returns the baseline. |
| private int | |
| public SynthContext | getContext(JComponent c)
Implements javax. Returns the Context for the specified component. |
| private SynthContext | |
| private SynthContext | |
| private SynthContext | |
| public Dimension | getMinimumSize(JComponent c)
Overrides javax. Returns the minimum size. |
| private int | Returns: padding required to keep label visible.index of the label to calculate pad for. i)Calculates the pad for the label at the specified index. |
| public Dimension | getPreferredSize(JComponent c)
Overrides javax. Returns the preferred size. |
| protected Dimension | |
| protected void | installDefaults(JSlider slider)
Overrides javax. Installs the defaults. |
| protected void | installListeners(JSlider slider)
Overrides javax. Installs listeners. |
| protected void | |
| public void | paint(Graphics
the g, JComponent Graphics object used for paintingthe component being painted c)Overrides javax. Paints the specified component according to the Look and Feel. |
| protected void | paint(SynthContext
context for the component being painted context, Graphics the g)Graphics object used for paintingPaints the specified component. |
| public void | paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)
Implements javax. Paints the border. |
| protected void | paintThumb(SynthContext
context for the component being painted context, Graphics Graphics object used for paintingbounding box for the thumb thumbBounds)Paints the slider thumb. |
| protected void | paintTrack(SynthContext
context for the component being painted context, Graphics Graphics object used for paintingbounding box for the track trackBounds)Paints the slider track. |
| public void | propertyChange(PropertyChangeEvent e)
Implements java. This method gets called when a bound property is changed. |
| protected void | recalculateIfInsetsChanged()
Overrides javax. Recalculates if the insets have changed. |
| private void | |
| public void | setThumbLocation(int x, int y)
Overrides javax. Sets the thumb location. |
| private void | |
| protected void | uninstallDefaults(JSlider slider)
Overrides javax. Uninstalls default setting. |
| protected void | uninstallListeners(JSlider slider)
Overrides javax. Uninstalls listeners. |
| public void | update(Graphics
the g, JComponent Graphics object used for paintingthe component being painted c)Overrides javax. Notifies this UI delegate to repaint the specified component. |
| private void | |
| private void | |
| private void | |
| public int | valueForXPosition(int xPos)
Overrides javax. Returns the value at the x position. |
| public int | valueForYPosition(int yPos)
Overrides javax. Returns the value at the y position. |
| protected int | xPositionForValue(int value)
Overrides javax. Returns the x position for a value. |
| protected int | yPositionForValue(int value, int trackY, int trackHeight)
Overrides javax. Returns the y location for the specified value. |
| lastSize | back to summary |
|---|---|
| private Dimension lastSize When a JSlider is used as a renderer in a JTable, its layout is not being recomputed even though the size is changing. Even though there is a ComponentListener installed, it is not being notified. As such, at times when being asked to paint the layout should first be redone. At the end of the layout method we set this lastSize variable, which represents the size of the slider the last time it was laid out. In the paint method we then check to see that this is accurate, that the slider has not changed sizes since being last laid out. If necessary we recompute the layout. | |
| paintValue | back to summary |
|---|---|
| private boolean paintValue | |
| sliderThumbStyle | back to summary |
|---|---|
| private SynthStyle sliderThumbStyle | |
| sliderTrackStyle | back to summary |
|---|---|
| private SynthStyle sliderTrackStyle | |
| style | back to summary |
|---|---|
| private SynthStyle style | |
| thumbActive | back to summary |
|---|---|
| private transient boolean thumbActive Used to determine the color to paint the thumb. | |
| thumbHeight | back to summary |
|---|---|
| private int thumbHeight | |
| thumbPressed | back to summary |
|---|---|
| private transient boolean thumbPressed | |
| thumbWidth | back to summary |
|---|---|
| private int thumbWidth | |
| trackBorder | back to summary |
|---|---|
| private int trackBorder | |
| trackHeight | back to summary |
|---|---|
| private int trackHeight | |
| valueRect | back to summary |
|---|---|
| private Rectangle valueRect | |
| SynthSliderUI | back to summary |
|---|---|
| protected SynthSliderUI(JSlider c) Constructs a
| |
| calculateGeometry | back to summary |
|---|---|
| protected void calculateGeometry() Overrides javax. Doc from javax. Calculates the geometry.
| |
| calculateThumbLocation | back to summary |
|---|---|
| protected void calculateThumbLocation() Overrides javax. Doc from javax. Calculates the thumb location.
| |
| createTrackListener | back to summary |
|---|---|
| protected BasicSliderUI. Overrides javax. Doc from javax. Creates a track listener.
| |
| createUI | back to summary |
|---|---|
| public static ComponentUI createUI(JComponent c) Hides javax. Creates a new UI object for the given component.
| |
| getBaseline | back to summary |
|---|---|
| public int getBaseline(JComponent c, int width, int height) Overrides javax. Doc from javax. Returns the baseline.
| |
| getComponentState | back to summary |
|---|---|
| private int getComponentState(JComponent c, Region region) | |
| getContext | back to summary |
|---|---|
| public SynthContext getContext(JComponent c) Implements javax. Doc from javax. Returns the Context for the specified component.
| |
| getContext | back to summary |
|---|---|
| private SynthContext getContext(JComponent c, int state) | |
| getContext | back to summary |
|---|---|
| private SynthContext getContext(JComponent c, Region subregion) | |
| getContext | back to summary |
|---|---|
| private SynthContext getContext(JComponent c, Region subregion, int state) | |
| getMinimumSize | back to summary |
|---|---|
| public Dimension getMinimumSize(JComponent c) Overrides javax. Doc from javax. Returns the minimum size.
| |
| getPadForLabel | back to summary |
|---|---|
| private int getPadForLabel(int i) Calculates the pad for the label at the specified index.
| |
| getPreferredSize | back to summary |
|---|---|
| public Dimension getPreferredSize(JComponent c) Overrides javax. Doc from javax. Returns the preferred size.
| |
| getThumbSize | back to summary |
|---|---|
| protected Dimension getThumbSize() Overrides javax. Doc from javax. Returns the thumb size.
| |
| installDefaults | back to summary |
|---|---|
| protected void installDefaults(JSlider slider) Overrides javax. Doc from javax. Installs the defaults.
| |
| installListeners | back to summary |
|---|---|
| protected void installListeners(JSlider slider) Overrides javax. Doc from javax. Installs listeners.
| |
| layout | back to summary |
|---|---|
| protected void layout() Lays out the slider. | |
| paint | back to summary |
|---|---|
| public void paint(Graphics g, JComponent c) Overrides javax. Paints the specified component according to the Look and Feel. This method is not used by Synth Look and Feel.
Painting is handled by the
| |
| paint | back to summary |
|---|---|
| protected void paint(SynthContext context, Graphics g) Paints the specified component.
| |
| paintBorder | back to summary |
|---|---|
| public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h) Implements javax. Doc from javax. Paints the border.
| |
| paintThumb | back to summary |
|---|---|
| protected void paintThumb(SynthContext context, Graphics g, Rectangle thumbBounds) Paints the slider thumb.
| |
| paintTrack | back to summary |
|---|---|
| protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds) Paints the slider track.
| |
| propertyChange | back to summary |
|---|---|
| public void propertyChange(PropertyChangeEvent e) Implements java. Doc from java. This method gets called when a bound property is changed.
| |
| recalculateIfInsetsChanged | back to summary |
|---|---|
| protected void recalculateIfInsetsChanged() Overrides javax. Doc from javax. Recalculates if the insets have changed.
| |
| setThumbActive | back to summary |
|---|---|
| private void setThumbActive(boolean active) | |
| setThumbLocation | back to summary |
|---|---|
| public void setThumbLocation(int x, int y) Overrides javax. Doc from javax. Sets the thumb location.
| |
| setThumbPressed | back to summary |
|---|---|
| private void setThumbPressed(boolean pressed) | |
| uninstallDefaults | back to summary |
|---|---|
| protected void uninstallDefaults(JSlider slider) Overrides javax. Uninstalls default setting. This method is called when a
| |
| uninstallListeners | back to summary |
|---|---|
| protected void uninstallListeners(JSlider slider) Overrides javax. Doc from javax. Uninstalls listeners.
| |
| update | back to summary |
|---|---|
| public void update(Graphics g, JComponent c) Overrides javax. Notifies this UI delegate to repaint the specified component.
This method paints the component background, then calls
the In general, this method does not need to be overridden by subclasses.
All Look and Feel rendering code should reside in the
| |
| updateStyle | back to summary |
|---|---|
| private void updateStyle(JSlider c) | |
| updateThumbState | back to summary |
|---|---|
| private void updateThumbState(int x, int y) | |
| updateThumbState | back to summary |
|---|---|
| private void updateThumbState(int x, int y, boolean pressed) | |
| valueForXPosition | back to summary |
|---|---|
| public int valueForXPosition(int xPos) Overrides javax. Doc from javax. Returns the value at the x position. If
| |
| valueForYPosition | back to summary |
|---|---|
| public int valueForYPosition(int yPos) Overrides javax. Doc from javax. Returns the value at the y position. If
| |
| xPositionForValue | back to summary |
|---|---|
| protected int xPositionForValue(int value) Overrides javax. Doc from javax. Returns the x position for a value.
| |
| yPositionForValue | back to summary |
|---|---|
| protected int yPositionForValue(int value, int trackY, int trackHeight) Overrides javax. Doc from javax. Returns the y location for the specified value. No checking is
done on the arguments. In particular if
| |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | mouseDragged(MouseEvent e)
Overrides javax. Implements java. Set the models value to the position of the top/left of the thumb relative to the origin of the track. |
| public void | mouseExited(MouseEvent e)
Overrides java. Implements java. Invoked when the mouse exits a component. |
| public void | mouseMoved(MouseEvent e)
Overrides javax. Implements java. Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed. |
| public void | mousePressed(MouseEvent e)
Overrides javax. Implements java. If the mouse is pressed above the "thumb" component then reduce the scrollbars value by one page ("page up"), otherwise increase it by one page. |
| public void | mouseReleased(MouseEvent e)
Overrides javax. Implements java. Invoked when a mouse button has been released on a component. |
| SynthTrackListener | back to summary |
|---|---|
| private SynthTrackListener() | |
| mouseDragged | back to summary |
|---|---|
| public void mouseDragged(MouseEvent e) Overrides javax. Implements java. Doc from javax. Set the models value to the position of the top/left of the thumb relative to the origin of the track.
| |
| mouseExited | back to summary |
|---|---|
| public void mouseExited(MouseEvent e) Overrides java. Implements java. Doc from java. Invoked when the mouse exits a component.
| |
| mouseMoved | back to summary |
|---|---|
| public void mouseMoved(MouseEvent e) Overrides javax. Implements java. Doc from javax. Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.
| |
| mousePressed | back to summary |
|---|---|
| public void mousePressed(MouseEvent e) Overrides javax. Implements java. Doc from javax. If the mouse is pressed above the "thumb" component then reduce the scrollbars value by one page ("page up"), otherwise increase it by one page. If there is no thumb then page up if the mouse is in the upper half of the track.
| |
| mouseReleased | back to summary |
|---|---|
| public void mouseReleased(MouseEvent e) Overrides javax. Implements java. Doc from javax. Invoked when a mouse button has been released on a component.
| |