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)
======================================================================