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

JButton doesn't handle return key event

XMLWordPrintable

    • beta
    • generic, x86, sparc
    • generic, solaris_2.6, solaris_7, windows_95, windows_nt



      Name: dbT83986 Date: 03/27/99


      In early swing, JButtons fired its ActionEvent on a return
      key press when it had the focus. Then, it did not and I
      subclassed the button to add this functionality back in.
      Later, it was added again so I had to take that feature out
      of my subclass. Now, it does not work again.

      I have never noticed JCheckBoxes and JRadioButtons to have
      this behaviour (performing a doClick() when the return
      key was pressed), but it seems like they should. Mice are used
      for about everything now, but it is often handy to have the
      keys to do things like this so one can easily tab around the
      screen and do stuff.
      Maybe the KeyListener should be added to AbstractButton and call
      doClick() whenever a return key (VK_ENTER) is pressed on it.

      Incidently, I tried to see the behaviour in Windows apps on NT
      and the return key usually closes the dialog and does not select
      on a check box. This was not what I suspected for some reason.
      Still, I like the feature.
      (Review ID: 56158)
      ======================================================================

      Name: krT82822 Date: 01/25/2000


      (see also 4227751 -> 4224702, 4235294)

      java full version "JDK-1.2.2-002"

      When a JButton has focus, you can press the Enter key on Windows to press the
      button. On Solaris, this does not work. Only the space bar will press the
      button. We are using the Java (Metal) look and feel, and expect it to behave
      the same on all platforms. Specifically, we would like the Enter key to press
      the button on Solaris, just as it does on Windows. You can reproduce this
      problem by using the button tab in the SwingSet demo.
      (Review ID: 100070)
      ======================================================================

            jeff Jeff Dinkins
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: