• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Grid Layout

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic