RFR: 8317836: FX nodes embedded in JFXPanel need to track component orientation [v2]

Andy Goryachev angorya at openjdk.org
Thu Oct 26 18:18:46 UTC 2023


On Thu, 26 Oct 2023 16:27:03 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:
> 
>   Optimization

modules/javafx.swing/src/main/java/javafx/embed/swing/JFXPanel.java line 817:

> 815:             ComponentOrientation cor = this.getComponentOrientation();
> 816:             if (!cor.equals(ComponentOrientation.UNKNOWN)) {
> 817:                 getScene().setNodeOrientation(cor.equals(ComponentOrientation.RIGHT_TO_LEFT) ?

1. I think getScene() might return null (sorry, did not see this immediately)
2. if possible, could we try limit code to one statement per line, i.e.


Scene scene = getScene(); // it's a volatile, so better assign to a variable
if(scene != null) {
  boolean rtl = cor.equals();
  scene.setNodeOrientation(rtl ? ...);
}

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1271#discussion_r1373573244


More information about the openjfx-dev mailing list