Skip to main content

Which way is up

Posted by daniel on October 2, 2003 at 6:18 AM PDT

Internationalizing your application is not just a matter of translating the words and checking with a native speaker that there aren't nuances you may have missed. You should also think about organizing the components on the screen so the flow is more natural.

In Also in Java Today we link to John Zukowski's Java Tech Tip Component Orientation in Swing User Interface . John explains that the java.awt.ComponentOrientation class

allows you to discover the current orientation for a Locale , and design screens accordingly. You ask for the ComponentOrientation of a Locale with the getOrientation(Locale) method. Then, you can ask if that orientation is horizontal with the isHorizontal method (horizontal corresponds to both the Left-to-right, top-to-bottom, and Right-to-left, top-to-bottom grids shown above). You can also ask if the orientation is left-to-right with the isLeftToRight method (left-to-right corresponds to both the Left-to-right and Top-to-bottom, left-to-right grids above).

He provides several examples after first talking about the use of the BorderLayout constants NORTH, SOUTH, EAST and WEST. John recommends using

Another set of constants: PAGE_START ,PAGE_END ,LINE_START , and LINE_END . (Note that these names were simplified in J2SE 1.4 from the earlier names that were added in the J2SE 1.2: BEFORE_FIRST_LINE (PAGE_START ), AFTER_LAST_LINE (PAGE_END ), BEFORE_LINE_BEGINS (LINE_START ), and AFTER_LINE_ENDS (LINE_END ).) Although EAST and WEST might make perfect sense for a Roman language, they don't necessarily make sense for other languages. For example, if you need to place a component at the beginning of the line, that component would need to be on the WEST side for a right-to-left language, but the EAST side for a left-to-right language. Instead of adding that component with an orientation of EAST or WEST , you should add it with a constraint of LINE_START . This will ensure the correct internationalized behavior.

Other components take care of the changes for you. JTrees will open right to left instead of left to right and containers using FlowLayout will "l draw their components in the reverse order when the orientation is right-to-left."

Today we also link to Stephen Montgomery's ONJava article Java for BioInformatics . Stephen shows that Bioinformatics isn't just for Perl programmers anymore with a selection of Java applications and some examples of how to use them.

Sue Spielman writes a "Dear John" letter to her debugger in her Weblog entry Dear John ... er ... I Mean Debugger . I can't tell you how long it's been since I started up a debugger. Unlike Sue, I haven't taken the time to ponder my loss. She echoes the experience of many who write code test first, "The more I’ve gotten into the TDD [(Test Driven Development)] habit; the less and less I’ve actually been in the debugger. Which is just fine by me. Because however much I loved my debugger, seeing the green bar is much more of a joy."

Sue ends by asking if you have "found some of your development tools changing with the methodologies you use? "

Today in Projects and Communities, we feature the JavaPedia article on Java Scripting . When do you find yourself reaching for a scripting language and why? In addition to starting a discussion on how to integrate the use of scripting languages with Java, the page includes links to some of the larger projects. Join in the discussion and supplement the list.

The latest Jini Community newsletter features John McClain's article Moving to Jini 2.0: Part 2. In this article, subtitled "Stop Relying on Automatic Stub Replacement", McClain takes you through the steps of where you should replace your use of this "when creating the JoinManager /smart proxy [and] anyplace you expect this (directly or indirectly) to be passed to/returned from a remote call."

In today's News Headlines :

Registered users can submit news items for the href=""> News Page using our
news submission form.
All submissions go through an editorial review by news director Steve
Mallet before being posted to the site. You can also subscribe to the href=""> News RSS

Current and upcoming Java Events:

Registered users can submit event listings for the href=""> Events Page using our href=""> events submission form.
All submissions go through an editorial review before being posted to the

This blog is delivered weekdays as the href="">Java Today RSS
feed. Once this page is no longer featured as the front page of href=""> Java Today it will be archived at href=""> You can
access other past issues in the href=""> Archive.