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

Regression: 1.3RC1 bug introduced in Window focus - toFront() always focus

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.3.0
    • client-libs
    • x86
    • windows_98



      Name: skT88420 Date: 02/04/2000


      C:\jdk1.3\bin>java -version
      java version "1.3.0rc1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
      Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)

      Desire is to have a second JFrame that when present is always on top.
      This is accomplished by a WindowListener (Hang the whole system -
      is this a feature ?)

        private class BasicWindowMonitor extends WindowAdapter {
              public void windowDeactivated(WindowEvent e) {
                Window window = e.getWindow();
                window.toFront();
                window.setVisible(true);
              }
        }

      Now that toFront() always sets focus (new in RC1), you can never
      focus the other JFrame's.

      SOURCE :
      ---------------

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

       public class BasicWindowMonitor extends WindowAdapter {

              public BasicWindowMonitor() {

                      JFrame myFrame = new JFrame();
                      myFrame.addWindowListener(this);
                      myFrame.getContentPane().setLayout(new FlowLayout());
                      myFrame.setBounds(50, 50, 200, 300);
                      myFrame.setVisible(true);
              }

              public void windowDeactivated(WindowEvent e) {
                Window window = e.getWindow();
                window.toFront();
                window.setVisible(true);
              }

              public static void main(String args[]) {

                      BasicWindowMonitor myMonitor = new BasicWindowMonitor();
              }

        }
      (Review ID: 100842)
      ======================================================================

            dmendenhsunw David Mendenhall (Inactive)
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: