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

Maximized JInternalFrame does not maintain state after iconified.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • client-libs



      Name: stC104175 Date: 06/19/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


      Maximize a JInternalFrame within a standard JDesktopPane with
      DefaultDesktopManager.
      Iconify the frame.
      Re-display the frame by double clicking on the icon.
      Presumably, the frame should appear with its last maximized size.
      It does not, due to a change from 1.2 to 1.3 in DefaultDesktopManager where,
      when iconified, the frame's setMaximum (false) is called.
      (Review ID: 106272)
      ======================================================================

      Name: rmT116609 Date: 10/25/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      /*
      Problem: JInternalFrame setIcon(true) does not deiconize to maximizeFrame

      Setup: java.version 1.3.0, NT 4.0 SP6

      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      Try the following:

      1) Maximize JInternalFrame using setMaximum(true)
          Result: isIcon() is false /? isMaximum() is true

      2) Iconize JInternalFrame using setIcon(true)
      ??? Result: isIcon() is true /? isMaximum() is false Why?

      3) Deiconize JInternalFrame using setIcon(false)
      ??? Result: isIcon() is false /? isMaximum() is false Why?

      //Author: John Petrula
      //Description: ###@###.###

      The code below demos problem.

      */

      package com.petrula.bug;

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

      public class MyFrame extends JFrame {

        public MyFrame() {
        }

        public static void main(String[] args) {
          try {
          // Windows L&F
          UIManager.setLookAndFeel(
            "com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

          // Create Desktop
          JDesktopPane desktopPane = new JDesktopPane();

          // Create JInternalFrame
          JInternalFrame internalFrame = new JInternalFrame( "My JInternalFrame",true, true, true, true);

          internalFrame.setBounds(200, 200, 200, 200);

          // Create JFrame
          MyFrame myFrame = new MyFrame();
          myFrame.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              System.exit(0);
            }
          });

          // Add JInternalFrame into Desktop and set Desktop as ContentPane
          desktopPane.add(internalFrame);
          myFrame.setContentPane(desktopPane);

          // Size and make JFrame visible
          myFrame.setSize(500,500);
          internalFrame.setVisible(true);
          myFrame.setVisible(true);

          // Maximize JInternalFrame

          System.out.println("Maximize using internalFrame.setMaximum(true)");
          internalFrame.setMaximum(true);
          myFrame.validate();
          System.out.println(internalFrame.isIcon() + " internalFrame.isIcon");
          System.out.println(internalFrame.isMaximum() + "
      internalFrame.isMaximum\n");
          Thread.sleep(3000);

          // Iconize JInternalFrame

          // Why is isMaximum() false after iconizing JInternalFrame?
          System.out.println("Iconify using internalFrame.setIcon(true)");
          internalFrame.setIcon(true);
          myFrame.validate();
          System.out.println(internalFrame.isIcon() + " internalFrame.isIcon");
          System.out.println(internalFrame.isMaximum() + " internalFrame.isMaximum -Why?\n");
          Thread.sleep(3000);

          // Deiconize JInternalFrame

          // Why is isMaximum() false after deiconizing JInternalFrame?
          System.out.println("Deiconify using internalFrame.setIcon(false);");
          internalFrame.setIcon(false);
          myFrame.validate();
          System.out.println(internalFrame.isIcon() + " internalFrame.isIcon");
          System.out.println(internalFrame.isMaximum() + " internalFrame.isMaximum -Wrong\n");
          }
          catch( Exception e) {
            e.printStackTrace();
          }
        }
      }
      (Review ID: 108286)
      ======================================================================

            joutwatesunw Joshua Outwater (Inactive)
            stompkinsunw Sean Tompkins (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: