-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0
-
x86
-
windows_nt
Name: diC59631 Date: 09/11/98
import com.sun.java.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
Title: Bad layout of JDesktopPane with maximized JInternalFrame
Description:
Resizing a JFrame that contains a JDesktopPane (below
or to the right of another component) that contains a
maximized JInternalFrame causes the JDesktopPane's
location to be set to (0,0).
*/
public class DesktopPaneLayoutBug extends JFrame
{
public DesktopPaneLayoutBug()
{
Dimension screenSize = getToolkit().getScreenSize();
setBounds (screenSize.width / 4, screenSize.height / 4,
screenSize.width / 2, screenSize.height / 2);
addWindowListener (new WindowAdapter() {
public void windowClosing (WindowEvent event)
{
System.exit(0);
}
});
} // constructor
static public void main(String args[])
{
JFrame mainFrame = new DesktopPaneLayoutBug();
Container mainContent = mainFrame.getContentPane();
JButton showBounds = new JButton ("Show Desktop Bounds");
JInternalFrame textFrame = new JInternalFrame ("Test", true, true, true, true);
textFrame.getContentPane().add (new JScrollPane (textArea));
desktop.add (textFrame);
showBounds.addActionListener (new ActionListener()
{
public void actionPerformed (ActionEvent e)
{
textArea.append ("Desktop bounds = " + desktop.getBounds() + "\n");
}
});
mainContent.add (showBounds, BorderLayout.NORTH);
mainContent.add (desktop, BorderLayout.CENTER);
mainFrame.show();
textFrame.show();
try {
textFrame.setMaximum (true);
} catch (java.beans.PropertyVetoException e) {}
} // main
static private JDesktopPane desktop = new JDesktopPane();
static private JTextArea textArea = new JTextArea ("Resize the JFrame and watch the JDesktopPane jump under the JButton\n");
} // DesktopPaneLayoutBug
(Review ID: 38627)
======================================================================
- duplicates
-
JDK-4176733 REGRESSION: JDesktopPane setVisible(true) need before adding JInternalFrames
-
- Resolved
-