-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.2.0
-
sparc
-
solaris_2.6
JDK Version: 1.2beta4-G
OS: Soalris 2.6
Locale: zh, C
Frame's pack() method sometimes make the frame just in the smallest size.
Following is a program to reproduce it.
===============================CheckPack.java=============================
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class CheckPack {
Choice choice1;
Choice choice2;
Choice choice3;
int itemCount = 0;
public static void main(String args[]) {
if (args.length < 1) {
System.out.println("Please type: java CheckPack n");
System.out.println(" n should be an integer");
return;
}
for (int i = 0; i < Integer.parseInt(args[0]); i ++) {
new CheckPack(i);
}
}
public CheckPack(int k) {
Frame f = new Frame("Check Choice");
f.setLayout(new BorderLayout());
choice1 = new Choice();
choice2 = new Choice();
choice3 = new Choice();
f.add(choice1, BorderLayout.NORTH);
f.add(choice3, BorderLayout.CENTER);
f.add(choice2, BorderLayout.SOUTH);
setData();
f.setLocation(k * 30, k * 30);
f.pack();
f.show();
}
public void setData() {
if (choice1 != null && itemCount < 20) {
for (int i = 0; i < 20; i ++) {
choice1.add("I am Choice, yes I am : " + itemCount * itemCount);
choice2.add("I am the same, yes I am : "+ itemCount * itemCount);
choice3.add("I am the same, yes I am : "+ itemCount * itemCount);
}
itemCount = 20;
}
}
}
===============================================================================
save this file
javac CheckPack.java
java CheckPack 10
you will see this problem
jim.hu@prc 1998-05-22
OS: Soalris 2.6
Locale: zh, C
Frame's pack() method sometimes make the frame just in the smallest size.
Following is a program to reproduce it.
===============================CheckPack.java=============================
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class CheckPack {
Choice choice1;
Choice choice2;
Choice choice3;
int itemCount = 0;
public static void main(String args[]) {
if (args.length < 1) {
System.out.println("Please type: java CheckPack n");
System.out.println(" n should be an integer");
return;
}
for (int i = 0; i < Integer.parseInt(args[0]); i ++) {
new CheckPack(i);
}
}
public CheckPack(int k) {
Frame f = new Frame("Check Choice");
f.setLayout(new BorderLayout());
choice1 = new Choice();
choice2 = new Choice();
choice3 = new Choice();
f.add(choice1, BorderLayout.NORTH);
f.add(choice3, BorderLayout.CENTER);
f.add(choice2, BorderLayout.SOUTH);
setData();
f.setLocation(k * 30, k * 30);
f.pack();
f.show();
}
public void setData() {
if (choice1 != null && itemCount < 20) {
for (int i = 0; i < 20; i ++) {
choice1.add("I am Choice, yes I am : " + itemCount * itemCount);
choice2.add("I am the same, yes I am : "+ itemCount * itemCount);
choice3.add("I am the same, yes I am : "+ itemCount * itemCount);
}
itemCount = 20;
}
}
}
===============================================================================
save this file
javac CheckPack.java
java CheckPack 10
you will see this problem
jim.hu@prc 1998-05-22