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):
private static final String SWING_UTILITIES2_NAME = LookUtils.IS_JAVA_6_OR_LATER ? "sun.swing.SwingUtilities2" : "com.sun.java.swing.SwingUtilities2";The screenshots for Tiger and Mustang (note the accelerator alignment problem which is better in Mustang but still slightly off - this has been fixed for Beta2 coming in the next few days):