import javax.swing.*;
import java.awt.event.*;
public class ButtonText extends JFrame
implements ActionListener {
public static void main(String[] args) {
ButtonText test = new ButtonText();
}
ButtonText ()
{
Frame frame=new Frame("Button Frame");
Button button1 = new Button("Submit");
Button button2 = new Button("Submit");
button1.addActionListener(this);
frame.add(button1);
frame.add(button2);
frame.setLayout(new FlowLayout());
frame.setSize(200,100);
frame.setVisible(true);
//System.out.println("123");
// System.exit(0);
}
public void actionPerformed(ActionEvent e)
{
int a ;
int b ;
int c ;
int d ;
int v ;
int f ;
int g ;
a=(int) (Math.random()*49+1) ;
b=(int) (Math.random()*49+1) ;
c=(int) (Math.random()*49+1) ;
d=(int) (Math.random()*49+1) ;
v=(int) (Math.random()*49+1) ;
f=(int) (Math.random()*49+1) ;
g=(int) (Math.random()*49+1) ;
System.out.println(a );
System.out.println(b );
System.out.println(c );
System.out.println(d );
System.out.println(v );
System.out.println(f );
System.out.println(g );}
}
沒有留言:
張貼留言