JDK-4846435 : Mnemonics not showing for JLabel in Windows LAF (Look and Feel)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1,1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2003-04-10
  • Updated: 2005-03-10
  • Resolved: 2005-03-10
Related Reports
Duplicate :  
Description

Name: jk109818			Date: 04/10/2003


FULL PRODUCT VERSION :
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)


FULL OS VERSION :
Microsoft Windows XP [Wersja 5.1.2600]


A DESCRIPTION OF THE PROBLEM :
Mnemonics do not show in JDialog when Windows L&F is selected.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached code.


EXPECTED VERSUS ACTUAL BEHAVIOR :
Pressing Alt key should make mnemonics visible.
Mnemonics never show.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class MnemonicApp extends JDialog
{	
	public MnemonicApp()
	{
		JPanel panel 			= new JPanel();
		JLabel label 			= new JLabel("Text");
		JTextField field	= new JTextField("ABC");
		JButton buttonA 	= new JButton("A");
		JButton buttonB 	= new JButton("B");
		
		label.setDisplayedMnemonic('T');
		label.setLabelFor(field);
		buttonA.setMnemonic('A');
		buttonB.setMnemonic('B');
		panel.setLayout(new FlowLayout());
		panel.add(label);
		panel.add(field);
		panel.add(buttonA);
		panel.add(buttonB);
		getContentPane().add(panel);
		getRootPane().setDefaultButton(buttonA);
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent event) {
					System.exit(0);
			}
		});
		buttonA.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent event)
			{
				JOptionPane.showMessageDialog(null, "alert", "alert",
					JOptionPane.ERROR_MESSAGE);
			}
		});
		setTitle("Mnemonic test");
		pack();
		show();
	}
	
	public static void main(String args[]) {
		try  {
	  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		}
		catch (Exception e) {		}
		new MnemonicApp();
	}
}


---------- END SOURCE ----------
(Review ID: 183817) 
======================================================================

Comments
EVALUATION Will address for next release. ###@###.### 2003-04-15 This bug is a duplicate of another one which was fixed in 1.4.2_06 and 5.0 releases. Closing as duplicate. ###@###.### 2005-03-10 16:57:05 GMT
15-04-2003