Class Banner

All Implemented Interfaces:
Accessible, Actionable, Buildable, ConstraintTarget, Proxy

@Generated("org.javagi.JavaGI") public final class Banner extends Widget implements Accessible, Actionable, Buildable, ConstraintTarget

A bar with contextual information.

banner

Banners are hidden by default, use Banner:revealed to show them.

Banners have a title, set with Banner:title. Titles can be marked up with Pango markup, use Banner:use-markup to enable it.

The title will be shown centered or left-aligned depending on available space.

Banners can optionally have a button with text on it, set through Banner:button-label. The button can be used with a GAction, or with the Banner::button-clicked signal. The button can have different styles, a gray style and a suggested style.

banner with suggested button style

CSS nodes

AdwBanner has a main CSS node with the name banner.

Since:
1.3
  • Constructor Details

    • Banner

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

      public Banner(String title)
      Creates a new AdwBanner.
      Parameters:
      title - the banner title
      Since:
      1.3
    • Banner

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

    • getType

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

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

      protected Banner 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
    • getButtonLabel

      public @Nullable String getButtonLabel()
      Gets the button label for self.
      Returns:
      the button label for this Banner
      Since:
      1.3
    • getButtonStyle

      public BannerButtonStyle getButtonStyle()
      Gets the style class in use for the banner button.
      Returns:
      the current button style
      Since:
      1.7
    • getRevealed

      public boolean getRevealed()
      Gets if a banner is revealed
      Returns:
      Whether a banner is revealed
      Since:
      1.3
    • getTitle

      public String getTitle()
      Gets the title for self.
      Returns:
      the title for this Banner
      Since:
      1.3
    • getUseMarkup

      public boolean getUseMarkup()
      Gets whether to use Pango markup for the banner title.
      Returns:
      whether to use markup
      Since:
      1.3
    • setButtonLabel

      public void setButtonLabel(@Nullable String label)

      Sets the button label for self.

      If set to "" or NULL, the button won't be shown.

      The button can be used with a GAction, or with the Banner::button-clicked signal.

      Parameters:
      label - the label
      Since:
      1.3
    • setButtonStyle

      public void setButtonStyle(BannerButtonStyle style)

      Sets the style class to use for the banner button.

      When set to Adw.BannerButtonStyle.default, the button is grey. When set to Adw.BannerButtonStyle.suggested, the button uses the .suggested-action appearance.

      banner with suggested button style
      Parameters:
      style - a button style
      Since:
      1.7
    • setRevealed

      public void setRevealed(boolean revealed)
      Sets whether a banner should be revealed
      Parameters:
      revealed - whether a banner should be revealed
      Since:
      1.3
    • setTitle

      public void setTitle(String title)

      Sets the title for this banner.

      See also: Banner:use-markup.

      Parameters:
      title - the title
      Since:
      1.3
    • setUseMarkup

      public void setUseMarkup(boolean useMarkup)

      Sets whether to use Pango markup for the banner title.

      See also Pango#parseMarkup.

      Parameters:
      useMarkup - whether to use markup
      Since:
      1.3
    • onButtonClicked

      This signal is emitted after the action button has been clicked.

      It can be used as an alternative to setting an action.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      1.3
      See Also:
    • emitButtonClicked

      public void emitButtonClicked()
      Emits the "button-clicked" signal. See onButtonClicked(Banner.ButtonClickedCallback).
    • builder

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