Issue #1006: JavaFX demo — embed chart in a VBox with other controls; fix Apple Silicon - #1021
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
SwingNodeis wrapped in aStackPanemarkedVBox.setVgrow(..., Priority.ALWAYS)— the key line, since a VBox only gives children their preferred height by default andXChartPanelreports a fixed preferred size.ButtonBarwith a Close button sits below the chart; the chart absorbs all resize space while the buttons keep their natural height.SwingUtilities.invokeLater, as the SwingNode javadoc requires.xchart-demo/pom.xml — JavaFX bumped 11.0.2 → 17.0.20 (demo module only):
UnsatisfiedLinkErroron Apple Silicon;mac-aarch64artifacts start at 17.0.2.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