| Locale-Sensitive Java Methodjavax.swing.AbstractButton
public void setMnemonic(int mnemonic)
 public void setMnemonic(char mnemonic)
 Internationalization (I18n) Method OverviewThis AbstractButtonmethod sets the keyboard mnemonic, which is a
         keyboard shortcut that the user can press (usually in conjunction with theAltkey) to activate the button.
		The mnemonic is usually a letter associated with the label of the button itself,
		such as 'S' for "Submit". The mnemonicargument passed into this method is either the intVK_XXXkeycode constant, which is defined injava.awt.event.KeyEventor a char literal that represents the 
		mnemonic. I18n IssuesThe mnemonic key is generally the same as one of the first letters
		in the button label. Once the application text is localized for several 
		languages and the correct translation pulled in at runtime, the
		original letter is often not a mnemonic for the new translations. For example, the Alt+Sshortcut
		would need to be altered for a Japanese user who instead of seeing a "Submit" button, sees
		a "堤出" button. Good I18n practice dictates that the mnemonic value
		be set dynamically according to the user's locale. Globalyzer will detect this call and report it as an I18n issue 
			regardless of whether mnemonic is being retrieved from a localized 
			properties file. If you have determined 
			that the call is being handled correctly, you can use Globalyzer's 
			Ignore Comment 
			functionality to ensure that it isn't picked up in a subsequent scan. Suggested Replacementpublic void setMnemonic(char mnemonic)
 Instead of: 
		JButton button = new JButton("Submit");button.setMnemonic('S');
 Use: 
		ResourceBundle bundle = ResourceBundle.getBundle(
 "myBundle", locale);
 JButton button = new JButton(bundle.get("submit_key"));
 String mnemonic = bundle.get("mnemonic_key");
 button.setMnemonic(mnemonic.charAt(0));
 Locale-Sensitive Java Methods    
 |