Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4475676
Votes 0
Synopsis under jdk1.3.1, when a new JFrame is launched, it will jump from one place to an
Category java:classes_awt
Reported Against 1.3.1
Release Fixed
State 11-Closed, Not Reproducible, bug
Priority: 2-High
Related Bugs
Submit Date 28-JUN-2001
Description
Compile and run the following codes under jdk1.3.1, you will find that the new created frame will move automatically, but under jdk1.2 and jdk1.4, the codes work well.

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

public class Test {
    public Test() {
        JFrame f = new JFrame("Test JFrame");
	JPanel p = new JPanel(new FlowLayout());
	JButton btn = new JButton("New Frame");
	btn.addActionListener(new ActionListener() {
	    public void actionPerformed(ActionEvent evt) {
	        JFrame newFrame = new JFrame("popup frame");
		JPanel pp = new JPanel();
		pp.setPreferredSize(new Dimension(300, 400));
		newFrame.setContentPane(pp);
		newFrame.pack();
		newFrame.setVisible(true);
	    }
	});
	p.add(btn);
	f.setContentPane(p);
	f.pack();
	f.setVisible(true);
    }

    public static void main(String[] args) {
        new Test();
    }
}

following is the java version info:

java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
Work Around
 xxxxx@xxxxx  2001-06-28
if we add the statement JFrame.setLocation() after pack() and before setVisible(), then the bug disappear.
Evaluation
This will happen if use only awt as well, reassigning to awt.
 xxxxx@xxxxx  2001-06-28

Yes, this is reproducable under 1.3.1, but not 1.4 so marking it as not reproducable under 1.4 as that is the next release.
 xxxxx@xxxxx  2001-06-28
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang