• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trouble in setDefaultLocale

 
Esmaeil Ashrafi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Esmaeil Ashrafi
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's work
Thank you
 
Campbell Ritchie
Sheriff
Pie
Posts: 49796
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that shows how useful old posts can be. And welcome to the Ranch, Saeid Zebardast
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic