Class TitledPane

All Implemented Interfaces:
LayoutMeasurable, LayoutMeasurableMixin, HasAlignmentProperty, HasBackgroundProperty, HasBlendModeProperty, HasBorderProperty, HasClipProperty, HasEffectProperty, HasFontProperty, HasGraphicProperty, HasHeightProperty, HasImageUrlProperty, HasLayoutXProperty, HasLayoutYProperty, HasManagedProperty, HasMaxHeightProperty, HasMaxWidthProperty, HasMinHeightProperty, HasMinWidthProperty, HasMouseTransparentProperty, HasOnMouseClickedProperty, HasOpacityProperty, HasPaddingProperty, HasParentProperty, HasPrefHeightProperty, HasPrefWidthProperty, HasSnapToPixelProperty, HasTextAlignmentProperty, HasTextFillProperty, HasTextProperty, HasVisibleProperty, HasWidthProperty, Styleable, EventTarget, Skinnable, INode, PreferenceResizableNode

@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"));
 
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.
    • isExpanded

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

      public final BooleanProperty expandedProperty()
      The expanded state of the TitledPane.
      Returns:
      the expanded property
      See Also:
    • 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.
    • 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.
      Returns:
      the animated property
      See Also:
    • setCollapsible

      public final void setCollapsible(boolean value)
      Specifies if the TitledPane can be collapsed. The default is true.
    • 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.
      Returns:
      the collapsible property
      See Also:
    • 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.