Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

trouble in setDefaultLocale

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's work
Thank you
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that shows how useful old posts can be. And welcome to the Ranch, Saeid Zebardast
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic