import javax.swing.*;
import java.awt.*;
public class GridLayoutDemo
{
private JFrame f;
private JButton b1,b2,b3,b4,b5;
public GridLayoutDemo()
{
f=new JFrame("grid window");
b1=new JButton("button1");
b2=new JButton("button2");
b3=new JButton("button3");
b4=new JButton("button4");
b5=new JButton("button5");
}
public void LaunchFrame()
{
f.setLayout(new GridLayout(3,2));
f.add(b1);
f.add(b2);
f.add(b3);
f.add(b4);
f.add(b5);
f.pack();
f.setSize(400,100);
f.setVisible(true);
}
public static void main(String a[])
{
GridLayoutDemo gd=new GridLayoutDemo
();
gd.LaunchFrame();
}
}
this is my program for grid layout Demo da program is getting complied but its not getting executedgrid.PNG
this is the error m getting