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

JFrame with warning banner layed out incorrectly when deiconified

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 1.3.0
    • 1.2.2
    • client-libs
    • 1.3
    • x86
    • windows_95, windows_nt

    Description



      Name: mc57594 Date: 12/12/99


      Possible duplicate of the unreproducible bugs:
      4184273 closed REGRESSION: INACTIVE WINDOW GET REPAINTED
      4195551 closed Repaint problems when frame is Deiconified

      [chamness]
      -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

      java version "1.2.2"
      HotSpot VM (1.0.1, mixed mode, build g)

      Compile the following test program and run it via the 1.2.2 applet viewer under
      NT (with active desktop update). Load the web page which references the applet
      from a web server rather than as a file.

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

      public class test extends JApplet
      {
          public void init()
          {
              JFrame jf = new JFrame( "test" );
              Container jc = jf.getContentPane();
              jc.setLayout( new BorderLayout() );
              jc.add( new JLabel( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" )
                      BorderLayout.CENTER );
              jf.pack();
              jf.show();
          }
      }

      If I minimize the JFrame then restore it, the text disappears. Depending on how
      I size and position the JFrame before minimizing it, the text can appear in the
      wrong place.
      If my policy allows display of applet windows without a warning banner, the
      JFrame is well behaved: it looks just the same after being restored.
      (Review ID: 98841)
      ======================================================================

      Name: krT82822 Date: 12/30/99


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      Problem: An applet launched JFrame does not redraw correctly
      upon being restored from a minimized state. To reproduce the
      problem compile and run the following java source (Test.java):

      // Test.java

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

      public class Test extends JApplet {

          public void init() {
              AFrame frame = new AFrame();
          }

          class AFrame extends JFrame {

              public AFrame() {
                  JButton button = new JButton("test");
                  getContentPane().add(button);
                  setSize(100, 100);
                  setVisible(true);
              }

          }

      }

      // eof Test.java

      Use the following HTML code to run the applet:

      <title>Test</title>
      <applet code="Test.class" width=350 height=100>
      </applet>

      Run the applet with appletviewer:

        appletviewer test.html <CR>

      When the JFrame pops up with the JButton on it, minimize the
      frame and then restore it -- the JButton will be skewed.
      (Review ID: 99454)
      ======================================================================

      Name: rl16235 Date: 06/21/2000


      java version "1.2.2"
      Classic VM (build JDK-1.2.2_005, native threads, symcjit)

      /* This program basically pops up a JFrame with a JPanel inside of it.
       *
       * If you then iconify the frame and deiconify it subsequently,
       * it is not laid out properly. You have to resize it before it
       * is shown properly.
       *
       * The workaround seems to be to invalidate() the container jframe on
       * window deiconify event. (This seems to indicate that the container
       * is not getting invalid when it is iconified and hence it is not
       * being laid out when de-iconified?)
       *
       * Env:
       * Java(TM) Plug-in: Version 1.2.2.p005
       * OR Appletviewer that is part of JDK1.2.2
       * WinNT 4.0 with service pack 5
       * netscape 4.73 or IE 5.00.2314.1003
       */

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

      public class AppletFrame extends Applet {
          public void init() {
      System.out.println("init..");
      if(jframe == null) {
      System.out.println("Creating new instance of JFrame");
      jframe = createJFrame();
      jframe.getContentPane().add(createJPanel());
      }
      System.out.println("jframe: "+jframe);
      jframe.pack();
      jframe.setVisible(true);

      // workaround: on window deiconify event, invalidate the
      // container so that layout is forced.
      jframe.addWindowListener(new WindowAdapter() {
      public void windowDeiconified(WindowEvent evt) {
      jframe.invalidate();
      }
      });
          }
          public void start() {
      System.out.println("start..");
          }
          public void stop() {
      System.out.println("stop..");
          }
          public void destroy() {
      System.out.println("destroy..");
          }
          private JFrame createJFrame() {
      JFrame jf = new JFrame("Test JFrame");
      return jf;
          }
          private JPanel createJPanel() {
      JPanel p = new JPanel();
      p.setPreferredSize(new Dimension(640, 480));
      p.add(new JButton("One"));
      p.add(new JButton("Two"));
      p.add(new JButton("Three"));
      return p;
          }
          private JFrame jframe;
      }

      ###@###.### 2000-06-21
      This bug is reproducible only on win_nt. To reproduce
      move the JFrame window before iconifyingit.
      Not reproducible on Solaris.
      (Review ID: 106262)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              amfowler Anne Fowler (Inactive)
              mchamnessunw Mark Chamness (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: