Class Scrollbar

All Implemented Interfaces:
Accessible, AccessibleRange, Buildable, ConstraintTarget, Orientable, Proxy

@Generated("org.javagi.JavaGI") public class Scrollbar extends Widget implements Accessible, AccessibleRange, Buildable, ConstraintTarget, Orientable

Shows a horizontal or vertical scrollbar.

An example GtkScrollbar

Its position and movement are controlled by the adjustment that is passed to or created by Scrollbar(). See Adjustment for more details. The Gtk.Adjustment:value field sets the position of the thumb and must be between Gtk.Adjustment:lower and Gtk.Adjustment:upper - Gtk.Adjustment:page-size. The Gtk.Adjustment:page-size represents the size of the visible scrollable area.

The fields Gtk.Adjustment:step-increment and Gtk.Adjustment:page-increment fields are added to or subtracted from the Gtk.Adjustment:value when the user asks to move by a step (using e.g. the cursor arrow keys) or by a page (using e.g. the Page Down/Up keys).

CSS nodes

scrollbar
╰── range[.fine-tune]
    ╰── trough
        ╰── slider

GtkScrollbar has a main CSS node with name scrollbar and a subnode for its contents. The main node gets the .horizontal or .vertical style classes applied, depending on the scrollbar's orientation.

The range node gets the style class .fine-tune added when the scrollbar is in 'fine-tuning' mode.

Other style classes that may be added to scrollbars inside ScrolledWindow include the positional classes (.left, .right, .top, .bottom) and style classes related to overlay scrolling (.overlay-indicator, .dragging, .hovering).

Accessibility

GtkScrollbar uses the Gtk.AccessibleRole.scrollbar role.

  • Constructor Details

    • Scrollbar

      public Scrollbar(MemorySegment address)
      Create a Scrollbar instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • Scrollbar

      public Scrollbar(Orientation orientation, @Nullable Adjustment adjustment)
      Creates a new scrollbar with the given orientation.
      Parameters:
      orientation - the scrollbar’s orientation.
      adjustment - the Adjustment to use, or null to create a new adjustment.
    • Scrollbar

      public Scrollbar()
      Create a new Scrollbar.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the Scrollbar class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected Scrollbar asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Widget
      Returns:
      the instance as if it were its parent type
    • getAdjustment

      public Adjustment getAdjustment()
      Returns the scrollbar's adjustment.
      Returns:
      the scrollbar's adjustment
    • setAdjustment

      public void setAdjustment(@Nullable Adjustment adjustment)
      Makes the scrollbar use the given adjustment.
      Parameters:
      adjustment - the adjustment to set
    • builder

      public static Scrollbar.Builder<? extends Scrollbar.Builder> builder()
      A Scrollbar.Builder object constructs a Scrollbar with the specified properties. Use the various set...() methods to set properties, and finish construction with Scrollbar.Builder.build().
      Returns:
      the builder object