展开全部
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class blue implements ActionListener
{
e68a843231313335323631343130323136353331333330343330JFrame frame;
JPanel p1,p2;
JButton b1,b2,b3,bb1,bb2,bb3;
JLabel lbl=new JLabel();
int i=0;
public static void main(String[] args){
blue qi=new blue();
qi.go();
}
public void go(){
frame=new JFrame("2012/6/24");
p1=new JPanel();
p2=new JPanel();
b1=new JButton("blue1");
b2=new JButton("blue2");
b3=new JButton("blue3");
p1.setLayout(new BorderLayout());
p1.add(b1);
p1.add("West",b2);
p1.add(b3);
bb1=new JButton("blue4");
bb2=new JButton("blue5");
bb3=new JButton("blue6");
p2.setLayout(new BorderLayout());
p2.add(bb1);
p2.add("West",bb2);
p2.add("South",bb3);
frame.getContentPane().add(p1);
frame.getContentPane().add("West",p2);
frame.getContentPane().add("North",lbl);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
bb1.addActionListener(this);
bb2.addActionListener(this);
bb3.addActionListener(this);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400,300);
frame.setLocation(500,300);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e){
i++;
lbl.setText("您已经点击了"+i+"次按钮!");
}
};