RFR: 8317836: FX nodes embedded in JFXPanel need to track component orientation [v6]
Kevin Rushforth
kcr at openjdk.org
Sat Oct 28 19:49:41 UTC 2023
On Sat, 28 Oct 2023 07:22:02 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> FX Nodes embedded in a Swing JFXPanel does not track the component orientation and FX nodes remain unaffected when component orientation changes.
>> Fix made sure JavaFX scene embedded in a JFXPanel should inherit the value from the JFXPanel.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> jcheck
I left some comments. This is heading in the right direction, but needs some adjustments.
modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/EmbeddedStage.java line 284:
> 282: }
> 283:
> 284: NodeOrientation orientation;
Move this to `com.sun.javafx.stage.EmbeddedWindow`.
modules/javafx.graphics/src/main/java/javafx/scene/Scene.java line 6352:
> 6350: parent = ((Stage)window).getOwner();
> 6351: } else if (window instanceof com.sun.javafx.embed.EmbeddedSceneInterface) {
> 6352: return ((com.sun.javafx.embed.EmbeddedStageInterface)window).getNodeOrientation();
This is the right idea, but the wrong type. The window, which is a `javafx.scene.Window` will never be an instance of `EmbeddedSceneInterface` which is a `GlassStage` peer. In the case of `JFXPanel`, the window will be a `com.sun.javafx.stage.EmbeddedWindow`.
modules/javafx.swing/src/main/java/javafx/embed/swing/JFXPanel.java line 818:
> 816: if (!cor.equals(ComponentOrientation.UNKNOWN)) {
> 817: boolean rtl = cor.equals(ComponentOrientation.RIGHT_TO_LEFT);
> 818: stagePeer.setNodeOrientation(rtl ? NodeOrientation.RIGHT_TO_LEFT :
You should set it on the `stage` not the `stagePeer`.
-------------
PR Review: https://git.openjdk.org/jfx/pull/1271#pullrequestreview-1702836662
PR Review Comment: https://git.openjdk.org/jfx/pull/1271#discussion_r1375313915
PR Review Comment: https://git.openjdk.org/jfx/pull/1271#discussion_r1375303233
PR Review Comment: https://git.openjdk.org/jfx/pull/1271#discussion_r1375306798
More information about the openjfx-dev
mailing list