Overview
JHeader is a horizontal navigation header component that extends JavaFX’s HBox. It provides three main sections: left (branding), center (menu items), and right (toolbar and user profile).
Constructor
Creates a new header with empty sections.
Methods
Branding
Sets the brand logo and title in the left section.
Menu Items
Adds a clickable menu item to the center section.
Adds a dropdown menu item to the center section.
Toolbar
Adds a custom node to the right toolbar section (appears before the user profile).
User Profile
Sets the user profile information in the right section.
Sets the user profile with a logout action.
Style Classes
Base style class applied to the header container
Applied to the left branding section
Applied to the brand title label
Applied to the center menu section
Applied to individual menu items
Applied to the right toolbar section
Applied to the user profile container
Applied to the user info text container
Applied to the user name label
Applied to the user email label
Applied to the avatar container
Applied to the avatar initials text
Applied to the popover header section (in profile dropdown)
Applied to popover title labels
Applied to popover subtitle labels
Applied to popover menu items
Example Usage
Behavior Notes
- The profile dropdown displays when clicking the user avatar
- The dropdown includes a “Cerrar Sesión” (Logout) option that triggers the
onLogoutaction - Menu dropdowns use
JPopoverfor positioning - Toolbar items are inserted before the user profile
- All methods return the header instance for fluent method chaining
Dependencies
- JPopover - Used for dropdown menus and profile menu
- JIcon - Can be used for menu icons and toolbar items
Source
com.jjarroyo.components.JHeader in JHeader.java:12