Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Grid Layout

 
Mindy Hudson
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.awt.*;
import java.applet.Applet;
public class glay6 extends Applet{
public void init(){
Button b=new Button("Hi");
add (b);
Button cb=new Button("Hello");
add (cb);
Button bc=new Button("Hell");
add (bc);
Button c=new Button("Hel");
add (c);
Button acb=new Button("He");
add (acb);
Button cba=new Button("H");
add (cba);
Button ba=new Button("H");
add (ba);
setLayout(new GridLayout(5,0));

}
}
Here I thought we should get
row1 col1 -Hi
row1 col2 -Hello
row2 col1 -Hell
row2 col2 -Hel
row3 col1 -He
row3 col2 -H
row4 col1 -H

But I am getting only one H.The lastone row4 col1 H is not visible.I think it should be there as I have created a new Button for each.Only the caption is the same.
Can anyone explain
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mindy,
Your code as you have given it above works for me!
I am using the appletviewer supplied with JDK1.2 and I get the following:
Hi Hello
Hell Hel
He H
H
buttons on the applet.
Regards,
Manfred.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic