Overview
JCard is a flexible container component that extends JavaFX’s VBox. It provides a structured layout with optional header (title, subtitle, toolbar), body content, footer, and built-in support for scrolling and collapse functionality.
Constructor
Creates an empty card.
Convenience constructor with title and content.
Convenience constructor with title and subtitle.
Methods
Header Configuration
Sets the card title. Creates the header section if it doesn’t exist.
Sets the card subtitle. Appears below the title in the header.
Adds a node to the header toolbar (positioned on the right side).
Adds or removes a border line below the header.
Content Configuration
Sets the main content of the card body.
Sets the footer content at the bottom of the card.
Makes the card body scrollable by wrapping it in a
ScrollPane.Collapse Functionality
Enables or disables the collapsible functionality. Adds a chevron icon to the header toolbar.
Sets the expanded/collapsed state of the card.
Styling
Adds custom CSS style classes to the card.
Style Classes
Base style class applied to the card container
Applied to the header container
Applied to the header when
setLine(true) is calledApplied to the container holding title and subtitle
Applied to the title label
Applied to the subtitle label
Applied to the toolbar container in the header
Applied to the body container
Applied to the footer container
Applied to the scroll pane when
makeScrollable() is calledApplied to the collapse/expand chevron icon
Example Usage
Source
com.jjarroyo.components.JCard in JCard.java:6