RFE: Setting text and mnemonic at once

This document describes the expected behaviour of the RFE 27009 implementation (named RFE: [I18N] All text & mnemonic as "An&ything").

The background

When developing easily i18zed applications there arise several problems around representing mnemonic keys:

The idea

It would be nice to set three properties of a button: text, mnemonic and displayedMnemonicIndex using only one string value, editable in NetBeans Form Editor.

It will solve many of i18n problems:

The solution and implementation details

The proposed solution is to use & symbol while editing text property to indicate that the next following letter will serve as mnemonic key.

Setting three properties at once and a lookup, which latin symbol is to be set as (real) mnemonic, is then implemented via a call of a method setLocalizedText of a class org.openide.awt.Mnemonics in NetBeans OpenAPIs.

This feature involves a non-standard extension of Swing APIs, that's why it's considered as non-recommended for general development, and will be:

In order to indicate, whether a particular form uses this non-standard extension or not, it's proposed to have a synthetic property "Generate Mnemonics code" for a top-level form container (e.g. JFrame) in "Code Generation" section.


author: Maxym Mykhalchuk
last modified 2.08.2003
revision 1.1, the history is available in CVS