I am placing [OK] and [Cancel] buttons horizontally in a Box (which has BoxLayout). Later I add this Box to BorderLayout.PAGE_END in content pane of JDialog. This works perfect in Windows, so [OK] is to left of [Cancel] - just like I have added.
When I test in Linux, the placement of buttons is same as Windows - [OK] to left of [Cancel]. This, again, follows from code.
However, in Linux (Ubuntu), the default placement for buttons is [Cancel] to left of [OK]. This contrasts with my code and placement of buttons.
So, my question is : Whether Java has some kind of constant - say OS_PLACEMENT, which can be set somewhere which will make [Cancel] button appear to left of [OK] in Linux? I am asking this because I know Java supports constants for RTL and LTR layout. Thus, I thought, there might be some constant(s) related to this kind of placement.
I wish to mention that I do set L&F of my Swing app to System L&F. Following is my first line in main()
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
When you say Linux (Ubuntu) you mean Gnome, right? The button placement by default (OS) of Gnome (Gtk) is placing Cancel button to the left.
You can try to change the Look and Feel of Swing : How to Set the Look and Feel