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

requestFocus doesn't work correctly in 1.2beta4

XMLWordPrintable

    • x86
    • windows_nt



      Name: el35337 Date: 09/16/98


      //When you close the red window the larger window
      //should come to the front and the lower TextField
      //should get the focus. Works in 1.1.6 but not in
      //1.2beta4

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

      class Focus extends Frame {
         
         TextField fld1;
         TextField fld2;
         
         public static void main(String[] args) {
            new Focus();
         }

         Focus() {
            super("Focus Test");

            setSize(300,300);

            fld1 = new TextField();
            add(fld1, "North");
            fld2 = new TextField();
            add(fld2, "South");
            addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent ev) {
                  setVisible(false);
                  dispose();
                  System.exit(0);
               }
            });
            setVisible(true);
            setEnabled(false);
            new Focus1(this);
         }
         
         void reactivate() {
            setEnabled(true);
            toFront();
            fld2.requestFocus();
         }
      }

      class Focus1 extends Frame {
         Focus1(final Focus parent) {
            super("Focus1");

            setSize(250,250);
            setBackground(Color.red);
            addWindowListener(new WindowAdapter() {
               public void windowClosing(WindowEvent ev) {
                  setVisible(false);
                  dispose();
                  parent.reactivate();
               }
            });
            setVisible(true);
         }
      }
      (Review ID: 38850)
      ======================================================================

            son Oleg Sukhodolsky (Inactive)
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: