BasicScrollBarUI (Java Platform SE 8 ) (original) (raw)
- javax.swing.plaf.ComponentUI
- javax.swing.plaf.ScrollBarUI
- javax.swing.plaf.basic.BasicScrollBarUI
- javax.swing.plaf.ScrollBarUI
All Implemented Interfaces:
LayoutManager, SwingConstants
Direct Known Subclasses:
MetalScrollBarUI, SynthScrollBarUI
public class BasicScrollBarUI
extends ScrollBarUI
implements LayoutManager, SwingConstants
Implementation of ScrollBarUI for the Basic Look and Feel
Nested Class Summary
Nested Classes
Modifier and Type Class Description protected class BasicScrollBarUI.ArrowButtonListener Listener for cursor keys. protected class BasicScrollBarUI.ModelListener A listener to listen for model changes. class BasicScrollBarUI.PropertyChangeHandler protected class BasicScrollBarUI.ScrollListener Listener for scrolling events initiated in theScrollPane. protected class BasicScrollBarUI.TrackListener Track mouse drags. Field Summary
Fields
* ### Fields inherited from interface javax.swing.[SwingConstants](../../../../javax/swing/SwingConstants.html "interface in javax.swing") `[BOTTOM](../../../../javax/swing/SwingConstants.html#BOTTOM), [CENTER](../../../../javax/swing/SwingConstants.html#CENTER), [EAST](../../../../javax/swing/SwingConstants.html#EAST), [HORIZONTAL](../../../../javax/swing/SwingConstants.html#HORIZONTAL), [LEADING](../../../../javax/swing/SwingConstants.html#LEADING), [LEFT](../../../../javax/swing/SwingConstants.html#LEFT), [NEXT](../../../../javax/swing/SwingConstants.html#NEXT), [NORTH](../../../../javax/swing/SwingConstants.html#NORTH), [NORTH_EAST](../../../../javax/swing/SwingConstants.html#NORTH%5FEAST), [NORTH_WEST](../../../../javax/swing/SwingConstants.html#NORTH%5FWEST), [PREVIOUS](../../../../javax/swing/SwingConstants.html#PREVIOUS), [RIGHT](../../../../javax/swing/SwingConstants.html#RIGHT), [SOUTH](../../../../javax/swing/SwingConstants.html#SOUTH), [SOUTH_EAST](../../../../javax/swing/SwingConstants.html#SOUTH%5FEAST), [SOUTH_WEST](../../../../javax/swing/SwingConstants.html#SOUTH%5FWEST), [TOP](../../../../javax/swing/SwingConstants.html#TOP), [TRAILING](../../../../javax/swing/SwingConstants.html#TRAILING), [VERTICAL](../../../../javax/swing/SwingConstants.html#VERTICAL), [WEST](../../../../javax/swing/SwingConstants.html#WEST)`
Constructor Summary
Constructors
Constructor Description BasicScrollBarUI() Method Summary
All Methods Static Methods Instance Methods Concrete Methods
Modifier and Type Method Description void addLayoutComponent(String name,Component child) If the layout manager uses a per-component string, adds the component comp to the layout, associating it with the string specified by name. protected void configureScrollBarColors() protected BasicScrollBarUI.ArrowButtonListener createArrowButtonListener() protected JButton createDecreaseButton(int orientation) protected JButton createIncreaseButton(int orientation) protected BasicScrollBarUI.ModelListener createModelListener() protected PropertyChangeListener createPropertyChangeListener() protected BasicScrollBarUI.ScrollListener createScrollListener() protected BasicScrollBarUI.TrackListener createTrackListener() static ComponentUI createUI(JComponent c) Dimension getMaximumSize(JComponent c) Returns the specified component's maximum size appropriate for the look and feel. protected Dimension getMaximumThumbSize() Returns the largest acceptable size for the thumb. protected Dimension getMinimumThumbSize() Returns the smallest acceptable size for the thumb. Dimension getPreferredSize(JComponent c) A vertical scrollbar's preferred width is the maximum of preferred widths of the (non null) increment/decrement buttons, and the minimum width of the thumb. boolean getSupportsAbsolutePositioning() Indicates whether the user can absolutely position the thumb with a mouse gesture (usually the middle mouse button). protected Rectangle getThumbBounds() Return the current size/location of the thumb. protected Rectangle getTrackBounds() Returns the current bounds of the track, i.e. protected void installComponents() protected void installDefaults() protected void installKeyboardActions() protected void installListeners() void installUI(JComponent c) Configures the specified component appropriately for the look and feel. boolean isThumbRollover() Returns true if the mouse is currently over the thumb. void layoutContainer(Container scrollbarContainer) Lays out the specified container. protected void layoutHScrollbar(JScrollBar sb) protected void layoutVScrollbar(JScrollBar sb) Dimension minimumLayoutSize(Container scrollbarContainer) Calculates the minimum size dimensions for the specified container, given the components it contains. void paint(Graphics g,JComponent c) Paints the specified component appropriately for the look and feel. protected void paintDecreaseHighlight(Graphics g) protected void paintIncreaseHighlight(Graphics g) protected void paintThumb(Graphics g,JComponent c,Rectangle thumbBounds) protected void paintTrack(Graphics g,JComponent c,Rectangle trackBounds) Dimension preferredLayoutSize(Container scrollbarContainer) Calculates the preferred size dimensions for the specified container, given the components it contains. void removeLayoutComponent(Component child) Removes the specified component from the layout. protected void scrollByBlock(int direction) protected void scrollByUnit(int direction) protected void setThumbBounds(int x, int y, int width, int height) Set the bounds of the thumb and force a repaint that includes the old thumbBounds and the new one. protected void setThumbRollover(boolean active) Sets whether or not the mouse is currently over the thumb. protected void uninstallComponents() protected void uninstallDefaults() protected void uninstallKeyboardActions() protected void uninstallListeners() void uninstallUI(JComponent c) Reverses configuration which was done on the specified component duringinstallUI. * ### Methods inherited from class javax.swing.plaf.[ComponentUI](../../../../javax/swing/plaf/ComponentUI.html "class in javax.swing.plaf") `[contains](../../../../javax/swing/plaf/ComponentUI.html#contains-javax.swing.JComponent-int-int-), [getAccessibleChild](../../../../javax/swing/plaf/ComponentUI.html#getAccessibleChild-javax.swing.JComponent-int-), [getAccessibleChildrenCount](../../../../javax/swing/plaf/ComponentUI.html#getAccessibleChildrenCount-javax.swing.JComponent-), [getBaseline](../../../../javax/swing/plaf/ComponentUI.html#getBaseline-javax.swing.JComponent-int-int-), [getBaselineResizeBehavior](../../../../javax/swing/plaf/ComponentUI.html#getBaselineResizeBehavior-javax.swing.JComponent-), [getMinimumSize](../../../../javax/swing/plaf/ComponentUI.html#getMinimumSize-javax.swing.JComponent-), [update](../../../../javax/swing/plaf/ComponentUI.html#update-java.awt.Graphics-javax.swing.JComponent-)` * ### Methods inherited from class java.lang.[Object](../../../../java/lang/Object.html "class in java.lang") `[clone](../../../../java/lang/Object.html#clone--), [equals](../../../../java/lang/Object.html#equals-java.lang.Object-), [finalize](../../../../java/lang/Object.html#finalize--), [getClass](../../../../java/lang/Object.html#getClass--), [hashCode](../../../../java/lang/Object.html#hashCode--), [notify](../../../../java/lang/Object.html#notify--), [notifyAll](../../../../java/lang/Object.html#notifyAll--), [toString](../../../../java/lang/Object.html#toString--), [wait](../../../../java/lang/Object.html#wait--), [wait](../../../../java/lang/Object.html#wait-long-), [wait](../../../../java/lang/Object.html#wait-long-int-)`
Field Detail
* #### minimumThumbSize protected [Dimension](../../../../java/awt/Dimension.html "class in java.awt") minimumThumbSize * #### maximumThumbSize protected [Dimension](../../../../java/awt/Dimension.html "class in java.awt") maximumThumbSize * #### thumbHighlightColor protected [Color](../../../../java/awt/Color.html "class in java.awt") thumbHighlightColor * #### thumbLightShadowColor protected [Color](../../../../java/awt/Color.html "class in java.awt") thumbLightShadowColor * #### thumbDarkShadowColor protected [Color](../../../../java/awt/Color.html "class in java.awt") thumbDarkShadowColor * #### thumbColor protected [Color](../../../../java/awt/Color.html "class in java.awt") thumbColor * #### trackColor protected [Color](../../../../java/awt/Color.html "class in java.awt") trackColor * #### trackHighlightColor protected [Color](../../../../java/awt/Color.html "class in java.awt") trackHighlightColor * #### scrollbar protected [JScrollBar](../../../../javax/swing/JScrollBar.html "class in javax.swing") scrollbar * #### incrButton protected [JButton](../../../../javax/swing/JButton.html "class in javax.swing") incrButton * #### decrButton protected [JButton](../../../../javax/swing/JButton.html "class in javax.swing") decrButton * #### isDragging protected boolean isDragging * #### trackListener protected [BasicScrollBarUI.TrackListener](../../../../javax/swing/plaf/basic/BasicScrollBarUI.TrackListener.html "class in javax.swing.plaf.basic") trackListener * #### buttonListener protected [BasicScrollBarUI.ArrowButtonListener](../../../../javax/swing/plaf/basic/BasicScrollBarUI.ArrowButtonListener.html "class in javax.swing.plaf.basic") buttonListener * #### modelListener protected [BasicScrollBarUI.ModelListener](../../../../javax/swing/plaf/basic/BasicScrollBarUI.ModelListener.html "class in javax.swing.plaf.basic") modelListener * #### thumbRect protected [Rectangle](../../../../java/awt/Rectangle.html "class in java.awt") thumbRect * #### trackRect protected [Rectangle](../../../../java/awt/Rectangle.html "class in java.awt") trackRect * #### trackHighlight protected int trackHighlight * #### NO\_HIGHLIGHT protected static final int NO_HIGHLIGHT See Also: [Constant Field Values](../../../../constant-values.html#javax.swing.plaf.basic.BasicScrollBarUI.NO%5FHIGHLIGHT) * #### DECREASE\_HIGHLIGHT protected static final int DECREASE_HIGHLIGHT See Also: [Constant Field Values](../../../../constant-values.html#javax.swing.plaf.basic.BasicScrollBarUI.DECREASE%5FHIGHLIGHT) * #### INCREASE\_HIGHLIGHT protected static final int INCREASE_HIGHLIGHT See Also: [Constant Field Values](../../../../constant-values.html#javax.swing.plaf.basic.BasicScrollBarUI.INCREASE%5FHIGHLIGHT) * #### scrollListener protected [BasicScrollBarUI.ScrollListener](../../../../javax/swing/plaf/basic/BasicScrollBarUI.ScrollListener.html "class in javax.swing.plaf.basic") scrollListener * #### propertyChangeListener protected [PropertyChangeListener](../../../../java/beans/PropertyChangeListener.html "interface in java.beans") propertyChangeListener * #### scrollTimer protected [Timer](../../../../javax/swing/Timer.html "class in javax.swing") scrollTimer * #### scrollBarWidth protected int scrollBarWidth Hint as to what width (when vertical) or height (when horizontal) should be. Since: 1.7 * #### incrGap protected int incrGap Distance between the increment button and the track. This may be a negative number. If negative, then an overlap between the button and track will occur, which is useful for shaped buttons. Since: 1.7 * #### decrGap protected int decrGap Distance between the decrement button and the track. This may be a negative number. If negative, then an overlap between the button and track will occur, which is useful for shaped buttons. Since: 1.7
Constructor Detail
* #### BasicScrollBarUI public BasicScrollBarUI()
Method Detail
* #### createUI public static [ComponentUI](../../../../javax/swing/plaf/ComponentUI.html "class in javax.swing.plaf") createUI([JComponent](../../../../javax/swing/JComponent.html "class in javax.swing") c) * #### configureScrollBarColors protected void configureScrollBarColors() * #### installUI public void installUI([JComponent](../../../../javax/swing/JComponent.html "class in javax.swing") c) Configures the specified component appropriately for the look and feel. This method is invoked when the `ComponentUI` instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following: 1. Install default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should _not_ be overridden. 2. Install a `LayoutManager` on the component if necessary. 3. Create/add any required sub-components to the component. 4. Create/install event listeners on the component. 5. Create/install a `PropertyChangeListener` on the component in order to detect and respond to component property changes appropriately. 6. Install keyboard UI (mnemonics, traversal, etc.) on the component. 7. Initialize any appropriate instance data. Overrides: `[installUI](../../../../javax/swing/plaf/ComponentUI.html#installUI-javax.swing.JComponent-)` in class `[ComponentUI](../../../../javax/swing/plaf/ComponentUI.html "class in javax.swing.plaf")` Parameters: `c` \- the component where this UI delegate is being installed See Also: [ComponentUI.uninstallUI(javax.swing.JComponent)](../../../../javax/swing/plaf/ComponentUI.html#uninstallUI-javax.swing.JComponent-), [JComponent.setUI(javax.swing.plaf.ComponentUI)](../../../../javax/swing/JComponent.html#setUI-javax.swing.plaf.ComponentUI-), [JComponent.updateUI()](../../../../javax/swing/JComponent.html#updateUI--) * #### uninstallUI public void uninstallUI([JComponent](../../../../javax/swing/JComponent.html "class in javax.swing") c) Reverses configuration which was done on the specified component during`installUI`. This method is invoked when this`UIComponent` instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed in `installUI`, being careful to leave the `JComponent` instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following: 1. Remove any UI-set borders from the component. 2. Remove any UI-set layout managers on the component. 3. Remove any UI-added sub-components from the component. 4. Remove any UI-added event/property listeners from the component. 5. Remove any UI-installed keyboard UI from the component. 6. Nullify any allocated instance data objects to allow for GC. Overrides: `[uninstallUI](../../../../javax/swing/plaf/ComponentUI.html#uninstallUI-javax.swing.JComponent-)` in class `[ComponentUI](../../../../javax/swing/plaf/ComponentUI.html "class in javax.swing.plaf")` Parameters: `c` \- the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components See Also: [ComponentUI.installUI(javax.swing.JComponent)](../../../../javax/swing/plaf/ComponentUI.html#installUI-javax.swing.JComponent-), [JComponent.updateUI()](../../../../javax/swing/JComponent.html#updateUI--) * #### installDefaults protected void installDefaults() * #### installComponents protected void installComponents() * #### uninstallComponents protected void uninstallComponents() * #### installListeners protected void installListeners() * #### installKeyboardActions protected void installKeyboardActions() * #### uninstallKeyboardActions protected void uninstallKeyboardActions() * #### uninstallListeners protected void uninstallListeners() * #### uninstallDefaults protected void uninstallDefaults() * #### createTrackListener protected [BasicScrollBarUI.TrackListener](../../../../javax/swing/plaf/basic/BasicScrollBarUI.TrackListener.html "class in javax.swing.plaf.basic") createTrackListener() * #### createArrowButtonListener protected [BasicScrollBarUI.ArrowButtonListener](../../../../javax/swing/plaf/basic/BasicScrollBarUI.ArrowButtonListener.html "class in javax.swing.plaf.basic") createArrowButtonListener() * #### createModelListener protected [BasicScrollBarUI.ModelListener](../../../../javax/swing/plaf/basic/BasicScrollBarUI.ModelListener.html "class in javax.swing.plaf.basic") createModelListener() * #### createScrollListener protected [BasicScrollBarUI.ScrollListener](../../../../javax/swing/plaf/basic/BasicScrollBarUI.ScrollListener.html "class in javax.swing.plaf.basic") createScrollListener() * #### createPropertyChangeListener protected [PropertyChangeListener](../../../../java/beans/PropertyChangeListener.html "interface in java.beans") createPropertyChangeListener() * #### setThumbRollover protected void setThumbRollover(boolean active) Sets whether or not the mouse is currently over the thumb. Parameters: `active` \- True indicates the thumb is currently active. Since: 1.5 * #### isThumbRollover public boolean isThumbRollover() Returns true if the mouse is currently over the thumb. Returns: true if the thumb is currently active Since: 1.5 * #### paint public void paint([Graphics](../../../../java/awt/Graphics.html "class in java.awt") g, [JComponent](../../../../javax/swing/JComponent.html "class in javax.swing") c) Paints the specified component appropriately for the look and feel. This method is invoked from the `ComponentUI.update` method when the specified component is being painted. Subclasses should override this method and use the specified `Graphics` object to render the content of the component. Overrides: `[paint](../../../../javax/swing/plaf/ComponentUI.html#paint-java.awt.Graphics-javax.swing.JComponent-)` in class `[ComponentUI](../../../../javax/swing/plaf/ComponentUI.html "class in javax.swing.plaf")` Parameters: `g` \- the `Graphics` context in which to paint `c` \- the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components See Also: [ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)](../../../../javax/swing/plaf/ComponentUI.html#update-java.awt.Graphics-javax.swing.JComponent-) * #### getPreferredSize public [Dimension](../../../../java/awt/Dimension.html "class in java.awt") getPreferredSize([JComponent](../../../../javax/swing/JComponent.html "class in javax.swing") c) A vertical scrollbar's preferred width is the maximum of preferred widths of the (non `null`) increment/decrement buttons, and the minimum width of the thumb. The preferred height is the sum of the preferred heights of the same parts. The basis for the preferred size of a horizontal scrollbar is similar. The `preferredSize` is only computed once, subsequent calls to this method just return a cached size. Overrides: `[getPreferredSize](../../../../javax/swing/plaf/ComponentUI.html#getPreferredSize-javax.swing.JComponent-)` in class `[ComponentUI](../../../../javax/swing/plaf/ComponentUI.html "class in javax.swing.plaf")` Parameters: `c` \- the `JScrollBar` that's delegating this method to us Returns: the preferred size of a Basic JScrollBar See Also: [getMaximumSize(javax.swing.JComponent)](../../../../javax/swing/plaf/basic/BasicScrollBarUI.html#getMaximumSize-javax.swing.JComponent-), [ComponentUI.getMinimumSize(javax.swing.JComponent)](../../../../javax/swing/plaf/ComponentUI.html#getMinimumSize-javax.swing.JComponent-) * #### getMaximumSize public [Dimension](../../../../java/awt/Dimension.html "class in java.awt") getMaximumSize([JComponent](../../../../javax/swing/JComponent.html "class in javax.swing") c) Returns the specified component's maximum size appropriate for the look and feel. If `null` is returned, the maximum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokes `getPreferredSize` and returns that value. Overrides: `[getMaximumSize](../../../../javax/swing/plaf/ComponentUI.html#getMaximumSize-javax.swing.JComponent-)` in class `[ComponentUI](../../../../javax/swing/plaf/ComponentUI.html "class in javax.swing.plaf")` Parameters: `c` \- The JScrollBar that's delegating this method to us. Returns: new Dimension(Integer.MAX\_VALUE, Integer.MAX\_VALUE); See Also: [ComponentUI.getMinimumSize(javax.swing.JComponent)](../../../../javax/swing/plaf/ComponentUI.html#getMinimumSize-javax.swing.JComponent-), [getPreferredSize(javax.swing.JComponent)](../../../../javax/swing/plaf/basic/BasicScrollBarUI.html#getPreferredSize-javax.swing.JComponent-) * #### createDecreaseButton protected [JButton](../../../../javax/swing/JButton.html "class in javax.swing") createDecreaseButton(int orientation) * #### createIncreaseButton protected [JButton](../../../../javax/swing/JButton.html "class in javax.swing") createIncreaseButton(int orientation) * #### paintDecreaseHighlight protected void paintDecreaseHighlight([Graphics](../../../../java/awt/Graphics.html "class in java.awt") g) * #### paintIncreaseHighlight protected void paintIncreaseHighlight([Graphics](../../../../java/awt/Graphics.html "class in java.awt") g) * #### paintTrack protected void paintTrack([Graphics](../../../../java/awt/Graphics.html "class in java.awt") g, [JComponent](../../../../javax/swing/JComponent.html "class in javax.swing") c, [Rectangle](../../../../java/awt/Rectangle.html "class in java.awt") trackBounds) * #### paintThumb protected void paintThumb([Graphics](../../../../java/awt/Graphics.html "class in java.awt") g, [JComponent](../../../../javax/swing/JComponent.html "class in javax.swing") c, [Rectangle](../../../../java/awt/Rectangle.html "class in java.awt") thumbBounds) * #### getMinimumThumbSize protected [Dimension](../../../../java/awt/Dimension.html "class in java.awt") getMinimumThumbSize() Returns the smallest acceptable size for the thumb. If the scrollbar becomes so small that this size isn't available, the thumb will be hidden. **Warning** : the value returned by this method should not be be modified, it's a shared static constant. Returns: The smallest acceptable size for the thumb. See Also: [getMaximumThumbSize()](../../../../javax/swing/plaf/basic/BasicScrollBarUI.html#getMaximumThumbSize--) * #### getMaximumThumbSize protected [Dimension](../../../../java/awt/Dimension.html "class in java.awt") getMaximumThumbSize() Returns the largest acceptable size for the thumb. To create a fixed size thumb one make this method and `getMinimumThumbSize` return the same value. **Warning** : the value returned by this method should not be be modified, it's a shared static constant. Returns: The largest acceptable size for the thumb. See Also: [getMinimumThumbSize()](../../../../javax/swing/plaf/basic/BasicScrollBarUI.html#getMinimumThumbSize--) * #### addLayoutComponent public void addLayoutComponent([String](../../../../java/lang/String.html "class in java.lang") name, [Component](../../../../java/awt/Component.html "class in java.awt") child) If the layout manager uses a per-component string, adds the component `comp` to the layout, associating it with the string specified by `name`. Specified by: `[addLayoutComponent](../../../../java/awt/LayoutManager.html#addLayoutComponent-java.lang.String-java.awt.Component-)` in interface `[LayoutManager](../../../../java/awt/LayoutManager.html "interface in java.awt")` Parameters: `name` \- the string to be associated with the component `child` \- the component to be added * #### removeLayoutComponent public void removeLayoutComponent([Component](../../../../java/awt/Component.html "class in java.awt") child) Removes the specified component from the layout. Specified by: `[removeLayoutComponent](../../../../java/awt/LayoutManager.html#removeLayoutComponent-java.awt.Component-)` in interface `[LayoutManager](../../../../java/awt/LayoutManager.html "interface in java.awt")` Parameters: `child` \- the component to be removed * #### preferredLayoutSize public [Dimension](../../../../java/awt/Dimension.html "class in java.awt") preferredLayoutSize([Container](../../../../java/awt/Container.html "class in java.awt") scrollbarContainer) Calculates the preferred size dimensions for the specified container, given the components it contains. Specified by: `[preferredLayoutSize](../../../../java/awt/LayoutManager.html#preferredLayoutSize-java.awt.Container-)` in interface `[LayoutManager](../../../../java/awt/LayoutManager.html "interface in java.awt")` Parameters: `scrollbarContainer` \- the container to be laid out See Also: [LayoutManager.minimumLayoutSize(java.awt.Container)](../../../../java/awt/LayoutManager.html#minimumLayoutSize-java.awt.Container-) * #### minimumLayoutSize public [Dimension](../../../../java/awt/Dimension.html "class in java.awt") minimumLayoutSize([Container](../../../../java/awt/Container.html "class in java.awt") scrollbarContainer) Calculates the minimum size dimensions for the specified container, given the components it contains. Specified by: `[minimumLayoutSize](../../../../java/awt/LayoutManager.html#minimumLayoutSize-java.awt.Container-)` in interface `[LayoutManager](../../../../java/awt/LayoutManager.html "interface in java.awt")` Parameters: `scrollbarContainer` \- the component to be laid out See Also: [LayoutManager.preferredLayoutSize(java.awt.Container)](../../../../java/awt/LayoutManager.html#preferredLayoutSize-java.awt.Container-) * #### layoutVScrollbar protected void layoutVScrollbar([JScrollBar](../../../../javax/swing/JScrollBar.html "class in javax.swing") sb) * #### layoutHScrollbar protected void layoutHScrollbar([JScrollBar](../../../../javax/swing/JScrollBar.html "class in javax.swing") sb) * #### layoutContainer public void layoutContainer([Container](../../../../java/awt/Container.html "class in java.awt") scrollbarContainer) Lays out the specified container. Specified by: `[layoutContainer](../../../../java/awt/LayoutManager.html#layoutContainer-java.awt.Container-)` in interface `[LayoutManager](../../../../java/awt/LayoutManager.html "interface in java.awt")` Parameters: `scrollbarContainer` \- the container to be laid out * #### setThumbBounds protected void setThumbBounds(int x, int y, int width, int height) Set the bounds of the thumb and force a repaint that includes the old thumbBounds and the new one. See Also: [getThumbBounds()](../../../../javax/swing/plaf/basic/BasicScrollBarUI.html#getThumbBounds--) * #### getThumbBounds protected [Rectangle](../../../../java/awt/Rectangle.html "class in java.awt") getThumbBounds() Return the current size/location of the thumb. **Warning** : the value returned by this method should not be be modified, it's a reference to the actual rectangle, not a copy. Returns: The current size/location of the thumb. See Also: [setThumbBounds(int, int, int, int)](../../../../javax/swing/plaf/basic/BasicScrollBarUI.html#setThumbBounds-int-int-int-int-) * #### getTrackBounds protected [Rectangle](../../../../java/awt/Rectangle.html "class in java.awt") getTrackBounds() Returns the current bounds of the track, i.e. the space in between the increment and decrement buttons, less the insets. The value returned by this method is updated each time the scrollbar is laid out (validated). **Warning** : the value returned by this method should not be be modified, it's a reference to the actual rectangle, not a copy. Returns: the current bounds of the scrollbar track See Also: [layoutContainer(java.awt.Container)](../../../../javax/swing/plaf/basic/BasicScrollBarUI.html#layoutContainer-java.awt.Container-) * #### scrollByBlock protected void scrollByBlock(int direction) * #### scrollByUnit protected void scrollByUnit(int direction) * #### getSupportsAbsolutePositioning public boolean getSupportsAbsolutePositioning() Indicates whether the user can absolutely position the thumb with a mouse gesture (usually the middle mouse button). Returns: true if a mouse gesture can absolutely position the thumb Since: 1.5
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.