Class TitledPane

All Implemented Interfaces:
Styleable, EventTarget, Skinnable

@DefaultProperty("content")
public class TitledPane
extends Labeled

A TitledPane is a panel with a title that can be opened and closed.

The panel in a TitledPane can be any Node such as UI controls or groups of nodes added to a layout container.

It is not recommended to set the MinHeight, PrefHeight, or MaxHeight for this control. Unexpected behavior will occur because the TitledPane's height changes when it is opened or closed.

Note that whilst TitledPane extends from Labeled, the inherited properties are used to manipulate the TitledPane header, not the content area itself. If the intent is to modify the content area, consider using a layout container such as StackPane and setting your actual content inside of that. You can then manipulate the StackPane to get the layout results you are after.

Example:

 TitledPane t1 = new TitledPane("T1", new Button("B1"));
Image of the TitledPane control
Since:
JavaFX 2.0
  • Property Details

  • Constructor Details

    • TitledPane

      public TitledPane()
      Creates a new TitledPane with no title or content.
    • TitledPane

      public TitledPane​(String title, Node content)
      Creates a new TitledPane with a title and content.
      Parameters:
      title - The title of the TitledPane.
      content - The content of the TitledPane.
  • Method Details

    • setContent

      public final void setContent​(Node value)

      The content of the TitlePane which can be any Node such as UI controls or groups of nodes added to a layout container.

      Parameters:
      value - The content for this TitlePane.
    • getContent

      public final Node getContent()
      The content of the TitledPane. Null is returned when if there is no content.
      Returns:
      The content of this TitledPane.
    • contentProperty

      public final ObjectProperty<Node> contentProperty()
      The content of the TitledPane.
      Returns:
      The content of the TitlePane.
    • setExpanded

      public final void setExpanded​(boolean value)
      Sets the expanded state of the TitledPane. The default is true.
      Parameters:
      value - a flag indicating the expanded state
    • isExpanded

      public final boolean isExpanded()
      Gets the value of the property expanded.
      Property description:
      The expanded state of the TitledPane.
    • expandedProperty

      public final BooleanProperty expandedProperty()
      The expanded state of the TitledPane.
      See Also:
      isExpanded(), setExpanded(boolean)
    • setAnimated

      public final void setAnimated​(boolean value)
      Specifies how the TitledPane should open and close. The panel will be animated out when this value is set to true. The default is true.
      Parameters:
      value - a flag indicating the animated state
    • isAnimated

      public final boolean isAnimated()
      Returns the animated state of the TitledPane.
      Returns:
      The animated state of the TitledPane.
    • animatedProperty

      public final BooleanProperty animatedProperty()
      The animated state of the TitledPane.
      See Also:
      isAnimated(), setAnimated(boolean)
    • setCollapsible

      public final void setCollapsible​(boolean value)
      Specifies if the TitledPane can be collapsed. The default is true.
      Parameters:
      value - a flag indicating the collapsible state
    • isCollapsible

      public final boolean isCollapsible()
      Returns the collapsible state of the TitlePane.
      Returns:
      The collapsible state of the TitledPane.
    • collapsibleProperty

      public final BooleanProperty collapsibleProperty()
      The collapsible state of the TitledPane.
      See Also:
      isCollapsible(), setCollapsible(boolean)
    • createDefaultSkin

      protected Skin<?> createDefaultSkin()
      Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).
      Overrides:
      createDefaultSkin in class Control
      Returns:
      new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.
    • getClassCssMetaData

      public static List<CssMetaData<? extends Styleable,​?>> getClassCssMetaData()
      Returns:
      The CssMetaData associated with this class, which may include the CssMetaData of its superclasses.
      Since:
      JavaFX 8.0
    • getControlCssMetaData

      public List<CssMetaData<? extends Styleable,​?>> getControlCssMetaData()
      Overrides:
      getControlCssMetaData in class Labeled
      Returns:
      unmodifiable list of the controls css styleable properties
      Since:
      JavaFX 8.0
    • getContentBias

      public Orientation getContentBias()
      Description copied from class: Labeled
      If wrapText is true, then contentBias will be HORIZONTAL, otherwise it is null.
      Overrides:
      getContentBias in class Labeled
      Returns:
      orientation of width/height dependency or null if there is none
      See Also:
      Node.isResizable(), Node.minWidth(double), Node.minHeight(double), Node.prefWidth(double), Node.prefHeight(double), Node.maxWidth(double), Node.maxHeight(double)
    • queryAccessibleAttribute

      public Object queryAccessibleAttribute​(AccessibleAttribute attribute, Object... parameters)
      This method is called by the assistive technology to request the value for an attribute.

      This method is commonly overridden by subclasses to implement attributes that are required for a specific role.
      If a particular attribute is not handled, the superclass implementation must be called.

      Overrides:
      queryAccessibleAttribute in class Control
      Parameters:
      attribute - the requested attribute
      parameters - optional list of parameters
      Returns:
      the value for the requested attribute
      See Also:
      AccessibleAttribute
    • executeAccessibleAction

      public void executeAccessibleAction​(AccessibleAction action, Object... parameters)
      This method is called by the assistive technology to request the action indicated by the argument should be executed.

      This method is commonly overridden by subclasses to implement action that are required for a specific role.
      If a particular action is not handled, the superclass implementation must be called.

      Overrides:
      executeAccessibleAction in class Control
      Parameters:
      action - the action to execute
      parameters - optional list of parameters
      See Also:
      AccessibleAction