import java.awt.*;
import java.awt.event.*;
class game0528 extends Canvas {
Frame fr;
int x;
public void paint( Graphics g ) {
x=x+1;
g.fillRect(50*x, 50,50,50);
}
game0528() {
x=0;
fr = new Frame( "フレーム" );
setSize( 500, 500 );
fr.add( this, BorderLayout.NORTH );
Button bu = new Button( "ボタン" );
fr.add( bu, BorderLayout.CENTER );
bu.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e ) {
repaint();
}
} );
fr.pack();
fr.setVisible( true );
fr.addWindowListener(new stopwin());
}
class stopwin extends WindowAdapter{
public void windowClosing(WindowEvent we){System.exit(0);}
}
public static void main( String[] args ) {
game0528 dr= new game0528();
}
}
最終更新:2011年02月25日 06:57