アットウィキロゴ

pro0618

import java.awt.*;
import java.awt.event.*;

class pro0618 extends Frame implements ActionListener{
Button bu;
public static void main( String[] args ) {
pro0618 f=new pro0618("pro0618");
f.buhin();
f.show();
}


pro0618(String s){
super(s);
setSize(500,500);
addWindowListener(new stopwin());
}


void buhin(){
Button bu = new Button( "ボタン" );
add(bu);
bu.addActionListener(this);
}

public void actionPerformed( ActionEvent e ) {
int n;
n=(int)(100*Math.random());
System.out.println(n); }
}

class stopwin extends WindowAdapter{
 public void windowClosing(WindowEvent we){System.exit(0);} 
 } 
最終更新:2010年09月17日 19:19