On Fri, 19 Jul 2024 09:07:58 GMT, Prasanta Sadhukhan <[email protected]> 
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?

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

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

Reply via email to