aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes trouble in setDefaultLocale Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "trouble in setDefaultLocale" Watch "trouble in setDefaultLocale" New topic
Author

trouble in setDefaultLocale

Esmaeil Ashrafi
Ranch Hand

Joined: Feb 22, 2010
Posts: 73
Hi all,
see the SSCCE please;

well, i want to see the button Yes at the most right side and the button No at the most left side.
So i used arabic locale that is a RTL locale and at least in orientation is like my native language Farsi.
But line #12 not seems to have any affect

Should be this way, should not have any affect on component orientation?
in real case I'll override default texts for each button and i like to change the orientation as well, but...

Thanks in advance


I'm really tired of being engaged with stuff other than Java and programming

Wish to get back soon to my love...
Esmaeil Ashrafi
Ranch Hand

Joined: Feb 22, 2010
Posts: 73
Hey fellas,
i just wanna share experiences i obtained in latest application i developed (that its GUI is a completely RTL , and caused me many questions that almost all of them answered here) and again ask my question related to this thread:

I had many JOptionPane.showxxxdialog methods in my app and making their directionality RTL was a huge pain to me that by overriding some values in UIManager (almost learned here ) i solved all of them, for example these:

after these changes, i needed to resolve the directionality problem, so rescue myself from writing code to create Components (JPanel almost) and pass them as message argument of showxxxDialog of JOptionPane method to show the user just a multi-lined simple string message in right-to-left order ...
i did that by setting (or applying) the ComponentOrientation of the frame that was the parent of JOptionPanes to RTL and just specify the first argument of showxxx to rootPane.Even in some cases (where the frame yet didn't initialize) i used a simple trick :

These issues forced me to take my first deepest look at one of the hugest core API classes (BasicOptionPaneUI, maybe for you that's not so huge, so sorry) and have the conscious of its keys, during this investigate, i found another interesting key: componentOrientation
but using this key didn't satisfy me, because it has no expected effect! about this, i think the reason is the JOptionPane uses its parent orientation and that makes the final decision for jOPtionPane's orientation, but whay it didn't work even when i used the null argument as the parent component ??

and at the end another point of my interest is the title of this topic:

i experimented this method for other components as well and got no effect on that component!
However i needed this method to work just to set the orientation of option pane RTL and that's resolved, but I'm wondered it does really work?

Thanks
Esmaeil Ashrafi
Saeid Zebardast
Greenhorn

Joined: Sep 07, 2010
Posts: 3
It's work
Thank you
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38865
    
  23
that shows how useful old posts can be. And welcome to the Ranch, Saeid Zebardast
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trouble in setDefaultLocale