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

Setting mnemonic to VK_F4 underlines the letter S in a button.

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic, x86
    • OS:
      generic, linux

      Description



      Name: rmT116609 Date: 04/17/2003


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

      FULL OS VERSION :
      Linux Mandrake 8.2
      2.4.18-6mdk
      Also in Windows XP, Windows 2000

      A DESCRIPTION OF THE PROBLEM :
      Using a JButtons setMnemonic(int i), and setting the button to VK_F4 causes the letter 'S' in the JButton to be underlined. The tooltip text clearly says Alt-F4. The value for VK_F4 is 115, which happens to be the byte value for lowercase 'S'.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run attached code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      nothing underlined?
        Tooltip text says "Shutdown Alt-F4"
      S on shutdown is underlined.
        Tooltip text says "Shutdown Alt-F4"

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      import javax.swing.JFrame;
      import javax.swing.JButton;
      import java.awt.event.KeyEvent;
      import java.awt.Dimension;

      public class Test {


        public static void main(String[] args) {
          JFrame f = new JFrame();
          JButton b = new JButton("Shutdown");
          b.setMnemonic(KeyEvent.VK_F4);
          b.setPreferredSize(new Dimension(100,25));
          b.setToolTipText("Shutdown");
          f.getContentPane().add(b);
          f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
          f.pack();
          f.show();
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Not using S in button?
      (Review ID: 184300)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: