RFR: 4265389: JSplitPane does not support ComponentOrientation [v6]
Tejesh R
tr at openjdk.org
Fri Jul 19 09:39:31 UTC 2024
On Fri, 19 Jul 2024 09:26:56 GMT, Prasanta Sadhukhan <psadhukhan 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?
> >
> >
> > Yeah, logically it is behaving right. But is it ok if component Orientation affect/creates confusion with the functionality? Say when user adds a component to left pane, set orientation to RIGHT_TO_LEFT and then removes left component which would actually remove right one sine its been oriented to right?
>
> left component is left component only...If user removes left componenet, it will remove what is on left no matter if the orientation is LTR or RTL so app needs to be mindful of that...I dont think there should be or is any confusion on that...
True, operation needs to be done based on appearance.
> > > > 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?
> >
> >
> > Yeah, logically it is behaving right. But is it ok if component Orientation affect/creates confusion with the functionality? Say when user adds a component to left pane, set orientation to RIGHT_TO_LEFT and then removes left component which would actually remove right one sine its been oriented to right?
>
> left component is left component only...If user removes left componenet, it will remove what is on left no matter if the orientation is LTR or RTL so app needs to be mindful of that...I dont think there should be or is any confusion on that...
True, operations should be performed based on appearance.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20214#issuecomment-2238771335
More information about the client-libs-dev
mailing list