Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4846435

Mnemonics not showing for JLabel in Windows LAF (Look and Feel)

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_2000, windows_xp

      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)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                leifs Leif Samuelsson (Inactive)
                Reporter:
                jkimsunw Jeffrey Kim (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: