Package swingtree

Class UIForAnyScrollPane<I,P extends JScrollPane>

java.lang.Object
swingtree.UIForAnything<I,P,JComponent>
swingtree.UIForAnySwing<I,P>
swingtree.UIForAnyScrollPane<I,P>
Type Parameters:
I - The concrete type of the builder instance, which is important as a return type for the builder methods.
P - The type of the scroll pane or any subclass of JScrollPane.
Direct Known Subclasses:
UIForScrollPane, UIForScrollPanels

public abstract class UIForAnyScrollPane<I,P extends JScrollPane> extends UIForAnySwing<I,P>
Defines an abstract builder for constructing a scroll pane or any subclass of JScrollPane.
  • Constructor Details

    • UIForAnyScrollPane

      public UIForAnyScrollPane()
  • Method Details

    • _addComponentTo

      protected void _addComponentTo(P thisComponent, JComponent addedComponent, @Nullable AddConstraint constraints)
      Description copied from class: UIForAnything
      This builder class expects its implementations to be builder types for anything which can be built in a nested tree-like structure. Implementations of this abstract method ought to enable support for nested building.

      Overrides:
      _addComponentTo in class UIForAnySwing<I,P extends JScrollPane>
      Parameters:
      thisComponent - The component which is wrapped by this builder.
      addedComponent - A component instance which ought to be added to the wrapped component type.
      constraints - The layout constraint which ought to be used to add the component to the wrapped component type.
    • withScrollBarPolicy

      public final I withScrollBarPolicy(UI.Active scrollPolicy)
      Use this to set the scroll bars policy for both horizontal and vertical scroll bars.
      The scroll policy can be one of the following:
      • UI.Active.NEVER: The scrolls bar will never be displayed.
      • UI.Active.ALWAYS: The scrolls bar will always be displayed.
      • UI.Active.AS_NEEDED: The two scroll bars will only be displayed when needed, i.e. when the content is too large to fit in the viewport and scrolling is required.
      Parameters:
      scrollPolicy - The scroll policy to use.
      Returns:
      The next builder instance, to allow for method chaining.
      Throws:
      NullPointerException - If the argument is null.
    • withVerticalScrollBarPolicy

      public final I withVerticalScrollBarPolicy(UI.Active scrollBarPolicy)
      Use this to set the scroll bars policy for the vertical scroll bar, which controls when the vertical scroll bar should be displayed or not.
      The scroll policy can be one of the following:
      • UI.Active.NEVER: The vertical scroll bar will never be displayed.
      • UI.Active.ALWAYS: The vertical scroll bar will always be displayed.
      • UI.Active.AS_NEEDED: The vertical scroll bar will only be displayed when needed, i.e. when the content is too large to fit in the viewport and scrolling is required.
      Parameters:
      scrollBarPolicy - The scroll policy to determine when the vertical scroll bar should be displayed.
      Returns:
      This builder node, to allow for method chaining.
      Throws:
      NullPointerException - If the argument is null.
    • withVerticalScrollBarPolicy

      public final I withVerticalScrollBarPolicy(sprouts.Val<UI.Active> scrollBarPolicy)
      Use this to dynamically set the scroll bars policy for the vertical scroll bar. When the property changes, the scroll bar policy will be updated accordingly.

      The scroll policy can be one of the following:

      • UI.Active.NEVER: The vertical scroll bar will never be displayed.
      • UI.Active.ALWAYS: The vertical scroll bar will always be displayed.
      • UI.Active.AS_NEEDED: The vertical scroll bar will only be displayed when needed, i.e. when the content is too large to fit in the viewport and scrolling is required.
      Parameters:
      scrollBarPolicy - The scroll policy property, whose value will determine when the vertical scroll bar should be displayed.
      Returns:
      This builder instance, to allow for method chaining.
    • withHorizontalScrollBarPolicy

      public final I withHorizontalScrollBarPolicy(UI.Active scrollBarPolicy)
      Use this to set the scroll bars policy for the horizontal scroll bar. The scroll policy can be one of the following:
      • UI.Active.NEVER: The horizontal scroll bar will never be displayed.
      • UI.Active.ALWAYS: The horizontal scroll bar will always be displayed.
      • UI.Active.AS_NEEDED: The horizontal scroll bar will only be displayed when needed, i.e. when the content is too large to fit in the viewport and scrolling is required.
      Parameters:
      scrollBarPolicy - The scroll policy to use.
      Returns:
      The next builder instance, to allow for method chaining.
      Throws:
      NullPointerException - If the argument is null.
    • withHorizontalScrollBarPolicy

      public final I withHorizontalScrollBarPolicy(sprouts.Val<UI.Active> scrollBarPolicy)
      Use this to dynamically set the scroll bars policy for the horizontal scroll bar. When the property changes, the scroll bar policy will be updated accordingly.

      The scroll policy can be one of the following:

      • UI.Active.NEVER: The horizontal scroll bar will never be displayed.
      • UI.Active.ALWAYS: The horizontal scroll bar will always be displayed.
      • UI.Active.AS_NEEDED: The horizontal scroll bar will only be displayed when needed, i.e. when the content is too large to fit in the viewport and scrolling is required.
      Parameters:
      scrollBarPolicy - The scroll policy property, whose value will determine when the horizontal scroll bar should be displayed.
      Returns:
      The next builder instance, to allow for method chaining.
      Throws:
      NullPointerException - If the argument is null.
    • withVerticalScrollIncrement

      public final I withVerticalScrollIncrement(int increment)
      Use this to set the vertical scroll increment unit, which controls how far the content moves when you use the mouse wheel, scroll gesture on a touchpad or press the arrow buttons on the scrollbar. This can be thought of as the smallest step size for scrolling. Like for example, scrolling by one line of text at a time in a text area.
      Parameters:
      increment - The scroll vertical increment to use.
      Returns:
      This builder instance, to allow for method chaining.
    • withHorizontalScrollIncrement

      public final I withHorizontalScrollIncrement(int increment)
      Use this to set the horizontal scroll increment unit, which typically controls how far the content moves when you:
      • press the left and right arrow buttons on the scrollbar
      • press the left and right arrow buttons on the keyboard
      • use the mouse wheel or scroll gesture on a touchpad

      This can be thought of as the smallest step size for scrolling. Like for example, scrolling by one line of text at a time in a text area.
      Parameters:
      increment - The scroll horizontal increment to use.
      Returns:
      This builder instance, to allow for method chaining.
    • withScrollIncrement

      public final I withScrollIncrement(int increment)
      Use this to set the vertical and horizontal scroll increment, which controls how far the content moves when you:
      • press the arrow buttons on the scrollbars
      • press the arrow buttons on the keyboard
      • use the mouse wheel or scroll gesture on a touchpad

      This can be thought of as the smallest step size for scrolling. Like for example, scrolling by one line of text at a time in a text area.
      Parameters:
      increment - The scroll increment to use.
      Returns:
      This builder instance, to allow for method chaining.
      See Also:
    • withVerticalBlockScrollIncrement

      public final I withVerticalBlockScrollIncrement(int increment)
      Use this to set the vertical scroll bar block increment, which typically controls how far the content moves when you:
      • press the page up or page down keys (not to be confused with the arrow keys)
      • click on a scroll bar track (the empty area of the scrollbar, not the thumb or arrows)
      It represents a larger jump, like moving an entire "page" or a significant chunk of content.

      Note, that if the argument is equal to the value of Integer.MIN_VALUE, then most look and feel implementations will not provide scrolling to the right/down.
      Please be aware that look and feel implementations that provide custom scrolling behavior may ignore the block increment value.

      Parameters:
      increment - The scroll vertical block increment to use when scrolling by a "block".
      Returns:
      This builder instance, to allow for method chaining.
    • withHorizontalBlockScrollIncrement

      public final I withHorizontalBlockScrollIncrement(int increment)
      Use this to set the horizontal scroll bar block increment, which typically controls how far the content moves to the left or right when you:
      • press the page up or page down keys (not to be confused with the arrow keys)
      • click on a scroll bar track (the empty area of the scrollbar, not the thumb or arrows)

      Please be aware that look and feel implementations that provide custom scrolling behavior may ignore the block increment value.
      Parameters:
      increment - The scroll horizontal block increment to use.
      Returns:
      This builder instance, to allow for method chaining.
    • withBlockScrollIncrement

      public final I withBlockScrollIncrement(int increment)
      Use this to set both the vertical and horizontal scroll block increment. The block increment is the amount to change the scrollbar's value by, given a block (usually "page") up/down request or when the user clicks above or below the scrollbar "knob" to change the value up or down by large amount.
      Please be aware that look and feel implementations that provide custom scrolling behavior may ignore the block increment value.
      Parameters:
      increment - The scroll block increment to use.
      Returns:
      This builder instance, to allow for method chaining.
      See Also: