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

Focus Freezes on Win32 after Dialog is Dismissed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 1.1.8
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_nt

      Description

      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");
      }



        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: