File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Grid Layout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Grid Layout" Watch "Grid Layout" New topic

Grid Layout

Mindy Hudson

Joined: Dec 08, 2000
Posts: 28
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

Joined: Jan 09, 2001
Posts: 1492
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
buttons on the applet.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Grid Layout
It's not a secret anymore!