import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
/*<applet code="Olyproex" height=650 width=1450></applet>*/
//button create in gridbaglayout
public class Olyproex extends Applet
{
Font f1;
GridBagLayout g1;
GridBagConstraints gbc;
JButton b1,b2,b3,b4,b5,b6,b7;
JFrame fm1;
Image pic;
//button creation code
public void init()
{
b1=new JButton();
b1.setIcon(new ImageIcon("E:\\javaproject\\img.jpg"));
b2=new JButton(new ImageIcon("E:\\javaproject\\img.jpg"));
b3=new JButton(new ImageIcon("E:\\javaproject\\img.jpg"));
b4=new JButton(new ImageIcon("E:\\javaproject\\img.jpg"));
b5=new JButton(new ImageIcon("E:\\javaproject\\img.jpg"));
b6=new JButton(new ImageIcon("E:\\javaproject\\img.jpg"));
b7=new JButton(new ImageIcon("E:\\javaproject\\img.jpg"));
f1 = new Font("Arial Black",Font.BOLD,36);
pic = getImage(getDocumentBase(),"img.jpg");
g1 = new GridBagLayout();
gbc= new GridBagConstraints();
setLayout(g1);
gbc.fill=GridBagConstraints.HORIZONTAL;
gbc.gridx=0;
gbc.gridy=0;
gbc.gridwidth=2;
gbc.ipady=40;
gbc.ipadx=40;
add(b1,gbc);
gbc.gridx=4;
gbc.gridy=0;
gbc.ipady=40;
gbc.ipadx=40;
add(b2,gbc);
gbc.gridx=8;
gbc.gridy=0;
gbc.ipady=40;
gbc.ipadx=40;
add(b3,gbc);
gbc.gridx=0;
gbc.gridy=4;
gbc.ipady=40;
gbc.ipadx=40;
add(b4,gbc);
gbc.gridx=4;
gbc.gridy=4;
gbc.ipady=40;
gbc.ipadx=40;
add(b5,gbc);
gbc.gridx=8;
gbc.gridy=4;
gbc.ipady=40;
gbc.ipadx=40;
add(b6,gbc);
gbc.gridx=4;
gbc.gridy=8;
gbc.ipady=40;
gbc.ipadx=40;
add(b7,gbc);
b1.setActionCommand("b1");
}
//onclick button code
public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("b1"))
{
fm1 = new JFrame("Second");
fm1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fm1.setSize(300,300);
fm1.setVisible(true);
}
}
}