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

Auto focus transfer to disabled component

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 1, 1.4.1
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic, x86
    • OS:
      generic, windows_2000

      Description

      Run the test case below. Click on button two. This disables button two and three. However, the auto focus transfer from the disabling of button two causes focus to go to the also disabled button three, and it can't be moved with tab traversal.

      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      public class ButTest extends JFrame {

          private JButton one = new JButton("one");
          private JButton two = new JButton("two");
          private JButton three = new JButton("three");
          private JButton four = new JButton("four");


          public ButTest() {
              super("ButTest");

              setLayout(new FlowLayout());
              add(one);
              add(two);
              add(three);
              add(four);

              two.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent ae) {
                      two.setEnabled(false);
                      three.setEnabled(false);
                  }
              });
          }

          private static void createAndShowGUI(String[] args) {
              ButTest test = new ButTest();
              test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              test.setSize(400, 400);
              test.setLocationRelativeTo(null);
              test.setVisible(true);
          }

          public static void main(final String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                  public void run() {
                      createAndShowGUI(args);
                  }
              });
          }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ant Anton Tarasov
                Reporter:
                shickeysunw Shannon Hickey (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Imported:
                  Indexed: