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.
      See Also:
      getContent(), setContent(Node)
    • 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)
    • 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