java问题~~~~~~~~
来源:百度知道 编辑:UC知道 时间:2024/06/12 01:03:02
其实要做一个整地程序,上面只是一部分。如果有高人想得分的话,加我我把要求说一下,qq:171993893,做好了给2000分~~~
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class SwingButton implements ActionListener{
private JFrame frame = null;
private JButton button = null;
private JLabel label = null;
private static int count = 0;
public SwingButton(){
frame = new JFrame("按钮窗口");
button = new JButton("按钮");
label = new JLabel();
label.setBackground(Color.gray);
button.addActionListener(this);
frame.setLayout(new FlowLayout(FlowLayout.CENTER));
frame.add(button);
frame.add(label);
frame.setSize(200, 100);
frame.setDefaultCloseOperation(JF