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

Focus Freezes on Win32 after Dialog is Dismissed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.1.8
    • client-libs
    • x86
    • windows_nt

      Bug #4176602 has been fixed and integrated into 1.1.8. However, the test case
      used in #4176602 still does not function properly. When the second dialog is dismissed, the focus does not respond to the tab key, but remains frozen in the first textfield. Only after the mouse is clicked in the second textfield does
      the focus move in response to the tab key.

      This bug occurs on win32 only.

      ------------------------------- FrozenFocus.java -------------------------------

      import java.awt.*;
      import java.awt.event.*;
      import java.net.*;

      public class FrozenFocus extends Frame {

        public FrozenFocus() {
          setSize(400, 300);
          setLayout(new FlowLayout());

          tf1.setColumns(10);
          tf2.setColumns(16);

          add(tf1);
          add(tf2);
          tf1.requestFocus();
          add(targetButton);

          targetButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              tf1.setText("");
              tf2.setText("");
              doDlgSequence();
            }
          });
        }


        public static void main(String[] args) {
          
          FrozenFocus ff = new FrozenFocus();
          ff.setVisible(true);
          dlg1 = new Dlg(ff, "This is dialog 1");
        }

        public void doDlgSequence() {
          showDlg1();
          showDlg2();
        }

        public void showDlg1() {
          dlg1.setVisible(true);
        }

        public void showDlg2() {
          Dlg dlg2 = new Dlg(new Frame(), "This is dialog 2");
          dlg2.setVisible(true);
          tf1.requestFocus();
        }

        Button targetButton = new Button("Click Here");

        static Dlg dlg1 ;
        static Frame frame;

        TextField tf1 = new TextField("Tab to next");
        TextField tf2 = new TextField("Tab to next");

      }

      class Dlg extends Dialog {
        public Dlg(Frame frame, String str) {
          super(frame);
          setSize(200, 200);
          setLayout(new FlowLayout());
          add(new Label(str));
          add(button);
          setModal(true);
          button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              setVisible(false);
            }
          });
        }

        Button button = new Button("OK");
      }



            rkhansunw Robi Khan (Inactive)
            nrodinsunw Nick Rodin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: