This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 26640 - RFE: One-line API call to set text, mnemonics & mnemonic index
Summary: RFE: One-line API call to set text, mnemonics & mnemonic index
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jesse Glick
Keywords: API, I18N
: 29676 30885 (view as bug list)
Depends on: 26678 31004 31093
Blocks: 27009 30885 31147
  Show dependency tree
Reported: 2002-08-20 15:42 UTC by _ mihmax
Modified: 2008-12-22 23:55 UTC (History)
6 users (show)

See Also:
Exception Reporter:

Mnemonics v4 (4.10 KB, application/octet-stream)
2003-02-09 20:56 UTC, _ mihmax
v4 with \n only (4.08 KB, application/octet-stream)
2003-02-09 21:18 UTC, _ mihmax

Note You need to log in before you can comment on or make changes to this bug.
Description _ mihmax 2002-08-20 15:42:16 UTC
I found a very serious bug in localized Netbeans:

When I translate, e.g. "&File" menu name into Russian, I 
have "&<SOME RUSSIAN SYMBOL>...", 
but then the key combination Alt+<SOME RUSSIAN SYMBOL> 
doesn't work!

All other menus and submenus, buttons, etc. are also 

I'd like this fixed for Netbeans 3.4, please.

Of course, the user may use the mouse, but the Keyboard is 
also handy thing ;)

And I do not like the way, used by Localizators of Mozilla 
(which also has the same bug), who just translated the 
menu name, but left the English key combination.
So "&File" menu would look like 
"<RUSSIAN TRANSLATION> (&F)" - this is not very attractive 
Comment 1 _ mihmax 2002-08-20 15:46:46 UTC
In order to simulate, download Russian L10N module from 
Daily Autoupdate or 
(Files section),
and add "-locale ru" into ide.cfg or command line of runide
Comment 2 Jesse Glick 2002-08-20 18:49:09 UTC
As mentioned on nbdev, there is no better way of doing this known to
us... you can use the Mozilla-style technique in NetBeans with no code
change. See Javadoc for Actions.{setMenuText,cutAmpersand} for
details, or Japanese bundles for examples.

If you know of a better solution which works with at least some
languages not using Roman script, please investigate, and reopen with
a patch. Properly testing such things requires knowledge of the kinds
of keyboards used by people working in such locales, for example.
Japanese localizers concluded that the current system was best for
Japanese - I don't know details.
Comment 3 _ mihmax 2002-09-04 14:33:48 UTC
As the resolution of issue

this can be fixed,
I'll prepare the setLabelText method patch, and hope that all of
Netbeans developers will use the setLabelText instead of setText &
setDisplayedMnemonic separately.
Comment 4 _ mihmax 2002-09-04 14:38:41 UTC
See also RFE
to module form.

I'd like that the form module use both setButtonText & setLabelText
from org.openide.awt.Actions.
Comment 5 Jaroslav Tulach 2002-09-04 16:41:35 UTC
I suggest to move the method from Actions class to Utilities class.
The reason is that Utilities are part of openide-util separate bundle
while Actions class is included just in the whole NetBeans
distribution. This could be useful for form editor users that could
bundle openide-util.jar (build by cd openide; ant libs) with their

public static void Utilities.setLocalizedText (AbstractButton b,
String text);
public static void Utilities.setLocalizedText (JLabel l, String text)

The Action.setXXX method would just delegate to Utilities.setLocalizedText
Comment 6 _ mihmax 2002-09-04 20:05:27 UTC
I've created patches for the form module, that fix this issue for all
AbstractButton's children.
Comment 7 _ mihmax 2002-09-04 20:31:55 UTC
Good idea, Jaroslav!!!
(or Jarda is better?)

> I suggest to move the method from Actions class to 
> Utilities class.

I'd suggest to create two separate files ??? and ???14 which will
contain only these pieces of code.
And put them into separate jar.

The reason:
Bundle for user-applications will be as small as possible.

> The Action.setXXX method would just delegate to 
> ???.setLocalizedText
No problem

Where's the right place for two new files?
I mean full path: module/src/.../ ;)
 (because, I didn't get the location you mention ;))

Comment 8 _ mihmax 2002-09-10 10:48:06 UTC
I suggest &
Comment 9 _ mihmax 2002-09-11 10:18:33 UTC
> I suggest to move the method from Actions class to Utilities class.

the openide-util.jar is also rather big for redistributing it with

My proposal:
    - setLocalizedText (AbstractButton b, String text);
    - setLocalizedText (JLabel b, String text);

Any other thoughts?
Comment 10 Jesse Glick 2002-09-11 16:18:19 UTC
Issue #27009 is the proper place to discuss whether & how could be redistributed to users. That question should be
handled by the form module developers. For example, they can easily
package any particular class from openide/src/ into a dedicated
redistributable JAR file without help from openide developers (simple
form/build.xml patch I guess).
Comment 11 _ mihmax 2002-10-21 20:52:00 UTC
Final proposal: 
1. This functionality is mainly for developing Netbeans using
Netbeans, hence it will be advertised as such to users ("Don't use it
unless you know what you're doing" ;) ).
2. It goes into 4.0
3. Names:
   Class is (+ * 
   Methods are:
     public static void setLocalizedLabel(AbstractButton b, String text);
     public static void setLocalizedLabel(JLabel l, String text);
If no feedback in 48 hours, I start coding & asking everybody on the
Earth to put my code into CVS, then to change all their code to use
mine ;-)

Sincere, Maxym
Comment 12 _ ttran 2003-01-29 10:15:08 UTC
IMO, this issue turned into an ENHANCEMENT, and it's for the form
module, not core/openide anymore.

I am reassinging it to the form module for further actions
Comment 13 Jesse Glick 2003-01-29 15:24:06 UTC
In fact it is intended to be an openide API addition with devel-time
support from form, plus numerous updates to actual uses of mnemonics
in various places throughout the NB UI.
Comment 14 _ ttran 2003-01-29 15:37:23 UTC
Hmm taking back to openide, but making this ENHANCEMENT
Comment 15 _ mihmax 2003-02-09 20:34:02 UTC
*** Issue 29676 has been marked as a duplicate of this issue. ***
Comment 16 _ mihmax 2003-02-09 20:50:13 UTC
I'm trying to order these two issues: 26640 and 27009.

This issue should be openide Enchancement to allow setting label and
mnemonics by a single API call.
That's why I change issue summary (was: I18N - Alt+Symbol doesn't work
for localized Menus, Buttons & Labels), and mark 27009 depend on this

Issue 27009 will be the change in form module to use this RFE in
NetBeans developing NetBeans.

Comment 17 _ mihmax 2003-02-09 20:56:14 UTC
Created attachment 8857 [details]
Mnemonics v4
Comment 18 _ mihmax 2003-02-09 21:00:30 UTC
The v4 attachment is a remake of v3 from issue 27009, changed upon
Jesse' suggestions.
Another thing Jesse suggested is to reassign this issue to him, so
please take it ;-)

// Don't forget that I'm using Windows, so change \r\n -> \n before
commiting in on Unix, because weird things happen then //
Comment 19 _ mihmax 2003-02-09 21:18:46 UTC
Created attachment 8858 [details]
v4 with \n only
Comment 20 Jesse Glick 2003-02-10 18:05:01 UTC
*** Issue 30885 has been marked as a duplicate of this issue. ***
Comment 21 Jesse Glick 2003-02-10 19:55:43 UTC
Done; Maxym please review & verify esp. using Russian locale.

committed   * Up-To-Date  1.102       openide/
committed   * Up-To-Date  1.137      
committed   * Up-To-Date  1.80       
removed     * Up-To-Date  1.1        
added       * Up-To-Date  1.1        
added       * Up-To-Date  1.1        
Comment 22 _ mihmax 2003-02-17 13:48:56 UTC
With (or even w/o) #31004,
in Russian locale the API gives the possibility to get the 
nice-looking underlined menus, buttons and labels under 
JDK1.4, now we need to replace:
- btn.setText(...);
- btn.setMnemonic(...);
- Mnemonics.setLocalizedText(btn,...);

all around NetBeans code... Allot places out there, so I 
filed a separate Task #31147 as an umbrella ;-)