Skip to content

Issue #1006: JavaFX demo — embed chart in a VBox with other controls; fix Apple Silicon - #1021

Merged
timmolter merged 2 commits into
developfrom
issue-1006-javafx-container-demo
Jul 30, 2026
Merged

Issue #1006: JavaFX demo — embed chart in a VBox with other controls; fix Apple Silicon#1021
timmolter merged 2 commits into
developfrom
issue-1006-javafx-container-demo

Conversation

@timmolter

Copy link
Copy Markdown
Member

Addresses the question in #1006: how to embed an XChart inside a JavaFX layout container (e.g. a VBox with a ButtonBar) so everything resizes with the window.

Changes

JavaFXDemo.java — now demonstrates the realistic embedding case from the issue:

  • The chart's SwingNode is wrapped in a StackPane marked VBox.setVgrow(..., Priority.ALWAYS) — the key line, since a VBox only gives children their preferred height by default and XChartPanel reports a fixed preferred size.
  • A ButtonBar with a Close button sits below the chart; the chart absorbs all resize space while the buttons keep their natural height.
  • Swing content is now built on the EDT via SwingUtilities.invokeLater, as the SwingNode javadoc requires.

xchart-demo/pom.xml — JavaFX bumped 11.0.2 → 17.0.20 (demo module only):

  • 11.0.2 ships x86_64-only macOS natives, so the demo crashed with UnsatisfiedLinkError on Apple Silicon; mac-aarch64 artifacts start at 17.0.2.
  • 17.x is the newest LTS line that still runs on Java 11 (JavaFX 21 raised the minimum JDK to 17), so this keeps the project's Java 11 baseline intact.

Testing

Verified manually on an Apple Silicon Mac with mvn javafx:run -pl xchart-demo: window opens, chart fills the space above the button bar, and both resize correctly with the window.

Closes #1006

🤖 Generated with Claude Code

timmolter and others added 2 commits July 30, 2026 17:33
Show the realistic embedding case from the issue: the chart inside a VBox
next to a ButtonBar, resizing with the window. The SwingNode is wrapped in
a StackPane marked VBox.setVgrow(ALWAYS) so it fills the leftover space,
and the Swing content is now built on the EDT as the SwingNode docs require.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
JavaFX 11.0.2 ships x86_64-only macOS natives, so the JavaFX demo fails
with UnsatisfiedLinkError on Apple Silicon. 17.x is the newest LTS line
that still runs on Java 11 (JavaFX 21 raised the minimum JDK to 17) and
the first with mac-aarch64 natives on Maven Central.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@timmolter
timmolter merged commit a93705a into develop Jul 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Embedding a chart inside a JavaFX container

1 participant