 |
Aligning menu items in Swing applications - welcome to the real world
Posted by kirillcool on February 18, 2006 at 12:53 PM | Comments (8)
When i have written the previous entry on aligning menu items in Swing applications, i was blissfully ignorant and thought that the life was good. Thankfully, one of the users of Substance has opened this defect with the following summary - "Menu texts are invisible in RTL orientation".
Why, say you. What's that RTL has to do with my application? Turns out that there are four locales that define the right-to-left orientation (who should know better than me...), Arabic (ar), Hebrew (iw), Persian (fa) and Urdu (ur). Under these locales, the users expect their applications to be layed-out correspondingly. Swing core look-and-feels provide quite a good support for this:
These two screenshots of Metal in Tiger and Metal in Mustang (you can see that Mustang properly aligns the texts, but fails quite miserably at aligning the accelerators):
The same problem with the accelerator alignment on RTL menus under Mustang is with the Windows LAF:
And what happens with the third-party LAFs you ask? Well, it depends. Here's a short chart of nine third-party open-source and commercial LAFs sorted by the degree of current RTL support in the menus (both under Tiger and Mustang):
The above support for RTL menus in Substance is available in the release candidate of version 2.2. In addition, the version 2.3 will provide full support for RTL features (including additional UI elements that Substance adds). Great thanks to the reporter that made me finally think of this and let's hope that the accelerator alignment issue will be addressed in the final release of Mustang.
Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
(w.r.t. NapkinLAF)
Ouch - looks like I'd better fix that, but...
Where did that arrow come from? I mean, if you look at here you should see a customised arrow for submenus...
Anyway, which build of NapkinLAF were you using for your screenshot? ;-)
Posted by: alexlamsl on February 21, 2006 at 10:28 PM
-
For Napkin it's 1.0 beta 005.
Posted by: kirillcool on February 21, 2006 at 10:37 PM
-
Hi Kirill, the layout and painting mechanism in JGoodies Looks is not bound to SwingUtilities2! SwingUtilities2 has nothing to do with the RTL problem. We use SwingUtilities2 only to paint strings. If SwingUtilities2 can not be accessed, we provide the fallbacks. If you like to understand the motivation behind the usage of SwingUtilities2, please, read the comments on the issue #69.-Andrej
Posted by: golovnin on February 22, 2006 at 12:10 AM
-
Andrej,
The original intent of the sentence was - JGoodies has its own layout and painting mechanism for the menus (in the menu renderer class). This mechanism (among the rest) uses SwingUtilities2 class to paint the menu text. It is correct that there's a fallback mechanism, but the use of SwingUtilities2 is still there. The lookup of the package name can be slightly better though - for Java 6 it has changed in the middle (i think from b61 or b62).
Posted by: kirillcool on February 22, 2006 at 12:17 AM
-
Having this fixed is useful for more that 4 locales. I just recently finished up a Java Applet for Tablet PC deployment and dealt heavily with this problem.
On a tablet, when "writing" with your right hand, having menus pop under your hand is tedious and difficult, being able to "right-align" the menus would be helpful.
It'd be great to have some integration (JDNC?) to detect that the device is a tablet, render the menus RTL (with a non-RTL locale) and have everything render correctly.
Posted by: mawcs on February 22, 2006 at 10:42 AM
-
Fixed in NapkinLAF - thanks for reporting ;-)
Posted by: alexlamsl on February 22, 2006 at 02:41 PM
-
Alex,
Is there a binary drop available to test and fix the screenshot?
Posted by: kirillcool on February 23, 2006 at 02:59 AM
-
I'm currently working on a few other issues, but if you want to I can send the latest build to you~
Posted by: alexlamsl on February 23, 2006 at 08:06 AM
|