import java.awt.*;
import java.awt.event.*;
import java.net.*;
class game extends Frame implements MouseListener{
int t;
String[] word=new String[10];
Image img;
game(){
try {
URL url = new URL("http://blog.ncam.shop-pro.jp/images/modiliani01.jpg");
img = Toolkit.getDefaultToolkit().getImage(url);
} catch (MalformedURLException ex) {ex.printStackTrace();}
t=1;
word[1]="みなさん、こんにちは";
word[2]="愛ですね";
word[3]="どらえもん";
this.addMouseListener(this);
}
public static void main(String[] args) {
game f = new game();
f.setSize(700,700);
f.setTitle("game");
f.setBackground(Color.yellow) ;
f.setVisible(true);
f.addWindowListener(new WindowAdapter(){public void
windowClosing(WindowEvent e){System.exit(0);}});
}
public void paint( Graphics g ) {
g.drawImage(img,0,0,700,700,this);
g.setColor(Color.black);
g.fillRect(0,600,700,100);
g.setColor(Color.white);
g.drawString(word[t],100,650);
}
public void mouseClicked(MouseEvent e) {
double mex,mey;
int h;
mey=e.getY();
mex=e.getX();
t=t+1;
if(t>3)t=1;
repaint();
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
}
最終更新:2011年08月07日 05:23