JDK-4524996 : Auto-maximization of non-maximizable internal frames with Windows LAF
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2001-11-08
  • Updated: 2001-11-18
  • Resolved: 2001-11-18
Related Reports
Duplicate :  
Description

Name: rmT116609			Date: 11/08/2001


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


Auto-maximization of internal frames with LAF Windows

This problem occurs with LAF Windows only. After having maximized
an internal frame, the following window that will be activated, will be
automatically maximized. To demonstrate the problem, you must run
the testcase attached. If you click several times on the New InternalFrame
button, you may see that frames are created quite normally. From the moment
you maximized an internal frame and clicked on the New InternalFrame
button, you may see that the last frame created is also maximized.
If you close the internal frames, you may see that all the frames previously
created are maximized though they were not before. Close all the frames, then
create a new frame, this one will be also maximized. To go back to a normal
  state,
you must click on the LAF Windows button (i.e. reset the look and feel).

If you are not convinced with the testcase, you may also run the
G:\jdk1.4\demo\jfc\SwingSet2\SwingSet2.jar  sample provided with JDK 1.4.
Set the LAF Windows by using the Menu bar. With the Internal Frame Generator,
create several windows. Maximize one of them, click on one of the buttons of the
Internal Frame Generator. This last window (i.e. the Internal Frame Generator)
will be also maximized, though it has not been asked. It's crazy.

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


/**
 * MaximizableInternalFrameMerlin.java
 */
import java.lang.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;

/**
 * Class:   MaximizableInternalFrameMerlin
 */
public class MaximizableInternalFrameMerlin extends javax.swing.JFrame
   {
    int frameId = 0;
    
    /**
     * Constructor: MaximizableInternalFrameMerlin
     * @return instance of MaximizableInternalFrameMerlin
     */
    public MaximizableInternalFrameMerlin()
       {
        final JFrame thisFrame = this;
        /* JFrame - Bean Properties */
        setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
        setTitle("MaximizableInternalFrameMerlin");
        /* JFrame - sets Bounds */
        setBounds(40,63,480,420);
        /* JFrame - Adds Child */
        final JDesktopPane desktopPane = new JDesktopPane();
        getContentPane().add(desktopPane,java.awt.BorderLayout.CENTER);
        
        JPanel southPanel = new JPanel();
        southPanel.setLayout(new FlowLayout());

        /* Button Create an InternalFrame */
        JButton button = new JButton();
        button.setText("New InternalFrame");
        southPanel.add(button);
        button.addActionListener(new java.awt.event.ActionListener()
           {
            public void actionPerformed(java.awt.event.ActionEvent e)
               {
                try
                   {
                    frameId = frameId + 1;
                    /* JInternalFrame - Bean Properties */
                    JInternalFrame internalFrame = new JInternalFrame("FrameID=" + frameId, true, true, true, false);
                    /* JInternalFrame - sets Bounds */
                    int position = (10 * frameId) % 100;
                    internalFrame.setBounds(position,position,250,180);
                    internalFrame.getContentPane().add(new JLabel("Frame ID=" + frameId),java.awt.BorderLayout.CENTER);
            
                    /* JDesktopPane - Adds Child */
                    desktopPane.add(internalFrame);
                    internalFrame.show();
                   }
                catch (java.lang.Throwable exc)
                   {
                    exc.printStackTrace();
                   }
               }
           });
           
        /* SouthPanel -  Adds Child */
        button = new JButton();
        /* Button Windows look and feel */
        button.setText("Sets LAF Windows");
        southPanel.add(button);
        button.addActionListener(new java.awt.event.ActionListener()
           {
            public void actionPerformed(java.awt.event.ActionEvent e)
               {
                try
                   {
                    /* Set Windows look and feel */
                    
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                    SwingUtilities.updateComponentTreeUI(thisFrame);
                   }
                catch (java.lang.Throwable exc)
                   {
                    exc.printStackTrace();
                   }
               }
           });
        /* Button Motif look and feel */
        button = new JButton();
        button.setText("Sets LAF Motif");
        southPanel.add(button);
        button.addActionListener(new java.awt.event.ActionListener()
           {
            public void actionPerformed(java.awt.event.ActionEvent e)
               {
                try
                   {
                    /* Set Motif look and feel */
                    
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
                    SwingUtilities.updateComponentTreeUI(thisFrame);
                   }
                catch (java.lang.Throwable exc)
                   {
                    exc.printStackTrace();
                   }
               }
           });
        getContentPane().add(southPanel,java.awt.BorderLayout.SOUTH);
        show();
       } /* End of Constructor: MaximizableInternalFrameMerlin */
           
    /**
     * Method: main <br>
     * Note: Called only if we're an application. <br>
     * @param java.lang.String[] args the command line arguments
     * @return void
     */
    public static void main(java.lang.String[] args)
       {
        try
           {
            /* Set Windows look and feel */
            
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              
            /* Creates new MainObject */
            MaximizableInternalFrameMerlin self = new
MaximizableInternalFrameMerlin();
           } /* End try */
        catch (java.lang.Throwable exc)
           {
            exc.printStackTrace(System.err);
           } /* End catch */
       } /* End of Method: main */

   } /* End of Class: MaximizableInternalFrameMerlin */
(Review ID: 135309) 
======================================================================

Comments
EVALUATION Under windows applications if you maximize an internal frame and then select another internal frame, via some button or by closing the current frame, the new frame will be maximized. This type of behavior can be seen from applications such as Adobe Acrobat. There is a problem if internal frames that don't want to get maximized get maximized anyway. This is seen in the SS2 demo when the internal frame generator is maximized. ###@###.### 2001-11-08 The bug concerning the maximization of unmaximizable internal frames is being tracked in bug 4490915. Closing this as a duplicate. ###@###.### 2001-11-17
08-11-2001