Hi Vivek,
I think there are some errors in your code . First the code starting with BigUpperPanel.setLayout() .... should be placed in a method block .
You should place the setBounds() statement after populating all the panels and adding them to the frame. Finally you should add setVisible(true) ; to make Frame visible . The method should be called in main .
I tried compiling and running your code. It gave an error for the Scrollbar constructor (Scrollbar.HORIZANTAL, int, int, int) .
The field HORIZANTAL should be made HORIZONTAL and the Constructor takes 5 ints (including Scrollbar.HORIZONTAL). Hope this information helps you .
Here is the copy of my program which is running fine :
import java.awt.*;
import java.awt.event.* ;
public class Heir extends Frame
{
Heir()
{
super("Containment Heirarchy Demo");
}
String strings[] = {"Red :", "Green :", "Blue :"};
Panel bigUpperPanel = new Panel();
public void go()
{
setLayout(new BorderLayout(0, 25));
bigUpperPanel.setLayout(new GridLayout(1, 3, 20, 0));
for (int i=0; i<3; i++)
{
Panel levelPanel = new Panel();
levelPanel.setLayout(new GridLayout(3, 1, 0, 10));
levelPanel.add(new Label(strings[i]));
levelPanel.add(
new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 255));
levelPanel.add(new TextField("0"));
bigUpperPanel.add(levelPanel);
}
add(bigUpperPanel, BorderLayout.CENTER);
Panel lowerPanel = new Panel();
lowerPanel.add(new Button("Apply"));
lowerPanel.add(new Button("Reset"));
lowerPanel.add(new Button("Cancel"));
add(lowerPanel, BorderLayout.SOUTH);
setBounds (20, 20, 300, 180);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0) ;
}
} ) ;
setVisible(true) ;
}
public static void main(String args[])
{
new Heir().go() ;
}
}