[1967] in java-interest
GridLayout weirdness...
daemon@ATHENA.MIT.EDU (Pat Niemeyer)
Wed Sep 20 17:31:18 1995
Date: Wed, 20 Sep 1995 14:04:14 -0500 (CDT)
From: Pat Niemeyer <pat@icon-stl.net>
To: java-interest@java.sun.com
Am I missing something or does the following code behave in unexpected ways?
I am trying to create a grid of four components, one of which
is a panel, also with four components.
When the panel layout is set to GridLayout its first two buttons never
appear. When it is set to FlowLayout all is well unless I resize the
appletviewer window, in which case the panel gets very confused.
I have also tried adding the empty panel first and then it's components,
which the same results. (I wouldn't have expected this to make a difference)
Any ideas?
// --------------------------------
import java.awt.*;
public class MyButtons extends java.applet.Applet {
public void init() {
setLayout(new GridLayout(2,2));
add(new Button("MyButton1"));
add(new Button("MyButton2"));
Panel p = new Panel();
//p.setLayout(new FlowLayout());
p.setLayout(new GridLayout(2,2));
p.add(new Button("PanelButton1"));
p.add(new Button("PanelButton2"));
p.add(new Button("PanelButton3"));
p.add(new Button("PanelButton4"));
add(p);
add(new Button("MyButton4"));
}
}
// Pat
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com