RFR: 4265389: JSplitPane does not support ComponentOrientation [v6]

Prasanta Sadhukhan psadhukhan at openjdk.org
Fri Jul 19 09:10:37 UTC 2024


On Fri, 19 Jul 2024 08:17:01 GMT, Tejesh R <tr at openjdk.org> wrote:

> After swapping the right/left component on componentOrientation, if user reset/remove+add another to either left/right won't it cause confusion? For example in this piece of code the frame ends up containing component one to right and another to left though I'm adding both the component to right.
> 
> ```
> JSplitPane jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
>        null, new JButton("Right_First"));
> jsp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
> jsp.setRightComponent(new JButton("Right_Second"));
> JFrame frame = new JFrame();
> frame.add(jsp);
> frame.pack();
> frame.setVisible(true);
> ```

I guess it's behaving as it should..
Initially, 
left component = null, RIght component = "Right_First"
After RTL orientation is invoked
left component = "Right_First", RIght component = null
AFter setRightComponent
left component = "Right_First", RIght component = "Right second"

If the application is programming that way, I guess it knows what it is doing, what's the confusion in that case?

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

PR Comment: https://git.openjdk.org/jdk/pull/20214#issuecomment-2238717778


More information about the client-libs-dev mailing list