javax.swing.plaf.basic

Class BasicScrollBarUI

    • Field Detail

      • minimumThumbSize

        protected Dimension minimumThumbSize
      • maximumThumbSize

        protected Dimension maximumThumbSize
      • thumbHighlightColor

        protected Color thumbHighlightColor
      • thumbLightShadowColor

        protected Color thumbLightShadowColor
      • thumbDarkShadowColor

        protected Color thumbDarkShadowColor
      • thumbColor

        protected Color thumbColor
      • trackColor

        protected Color trackColor
      • trackHighlightColor

        protected Color trackHighlightColor
      • incrButton

        protected JButton incrButton
      • decrButton

        protected JButton decrButton
      • isDragging

        protected boolean isDragging
      • trackHighlight

        protected int trackHighlight
      • scrollTimer

        protected Timer 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

      • configureScrollBarColors

        protected void configureScrollBarColors()
      • installUI

        public void installUI(JComponent c)
        Description copied from class: ComponentUI
        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 in class ComponentUI
        Parameters:
        c - the component where this UI delegate is being installed
        See Also:
        ComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()
      • uninstallUI

        public void uninstallUI(JComponent c)
        Description copied from class: ComponentUI
        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 in class ComponentUI
        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), JComponent.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()
      • 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 g,
                 JComponent c)
        Description copied from class: ComponentUI
        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 in class ComponentUI
        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)
      • getPreferredSize

        public 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. 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 in class ComponentUI
        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), ComponentUI.getMinimumSize(javax.swing.JComponent)
      • getMaximumSize

        public Dimension getMaximumSize(JComponent c)
        Description copied from class: ComponentUI
        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 in class ComponentUI
        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), getPreferredSize(javax.swing.JComponent)
      • createDecreaseButton

        protected JButton createDecreaseButton(int orientation)
      • createIncreaseButton

        protected JButton createIncreaseButton(int orientation)
      • paintDecreaseHighlight

        protected void paintDecreaseHighlight(Graphics g)
      • paintIncreaseHighlight

        protected void paintIncreaseHighlight(Graphics g)
      • getMinimumThumbSize

        protected Dimension 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()
      • getMaximumThumbSize

        protected Dimension 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()
      • addLayoutComponent

        public void addLayoutComponent(String name,
                              Component child)
        Description copied from interface: LayoutManager
        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 in interface LayoutManager
        Parameters:
        name - the string to be associated with the component
        child - the component to be added
      • removeLayoutComponent

        public void removeLayoutComponent(Component child)
        Description copied from interface: LayoutManager
        Removes the specified component from the layout.
        Specified by:
        removeLayoutComponent in interface LayoutManager
        Parameters:
        child - the component to be removed
      • layoutVScrollbar

        protected void layoutVScrollbar(JScrollBar sb)
      • layoutHScrollbar

        protected void layoutHScrollbar(JScrollBar sb)
      • layoutContainer

        public void layoutContainer(Container scrollbarContainer)
        Description copied from interface: LayoutManager
        Lays out the specified container.
        Specified by:
        layoutContainer in interface LayoutManager
        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()
      • getThumbBounds

        protected Rectangle 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)
      • getTrackBounds

        protected Rectangle 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)
      • 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

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

21/11/2024 21:21:50 Cette version de la page est en cache (à la date du 21/11/2024 21:21:50) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.

Document créé le 01/09/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/swing/plaf/basic/basicscrollbarui.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, BasicScrollBarUI

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.

Table des matières Haut