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

REGRESSION: JFrame goes to back after toFront() is called when Applet starts

XMLWordPrintable

    • b02
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      Upon launching an applet, if the applet tries to display a JFrame in front of it's web browser window using the .toFront() method, the JFrame appears momentarily then disappears behind the browser window.

      The same behaviour is experienced on
      IE version: 6.0.2900.2180.xpsp_sp2_rtm.040803-2158
      Firefox version 1.0

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Save the two source code snippets as ToFrontTest.java and ToFrontTest.html.
      Compile ToFrontTest.java and launch ToFrontTest.html with the web browser window maximised.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The frontFrame should appear and stay in front of the applet/web browser .
      ACTUAL -
      The frontFrame appears momentarily then disappears behind the applet/web browser.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.applet.*;
      import javax.swing.*;
       
      public class ToFrontTest extends Applet
      {
          public ToFrontTest()
          {
          }
          public void init()
          {
              JFrame frontFrame = new JFrame("toFront() Test Frame");
              frontFrame.getContentPane().setLayout(new BorderLayout());
              frontFrame.getContentPane().add(new JLabel("Am I in front?"),BorderLayout.CENTER);
              frontFrame.setSize(300, 300);
              frontFrame.setVisible(true);
              frontFrame.toFront();
          }
      }

      ------------------------------

      <html>
      <head>
      <title>ToFront() HTML Test Page</title>
      </head>
      <body>
        ToFrontTest will appear below in a Java enabled browser.<br>
      <applet
        codebase = "."
        code = "ToFrontTest.class"
        name = "ToFrontTest"
        width = "400"
        height = "300"
        hspace = "0"
        vspace = "0"
        align = "middle"
      >
      </applet>
      </body>
      </html>
      ---------- END SOURCE ----------

      Release Regression From : 1.4.2
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.
      ###@###.### 2004-12-09 15:23:35 GMT

            kbalasubsunw Kannan Balasubramanian (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: