import java.net.*;
import java.awt.*;
import java.awt.event.*;
class pro extends Frame implements MouseListener{
Image img;
String str;
double w,h;
public static void main(String[] args) {
pro f = new pro();
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);}});
}
pro(){
w=35.7;
h=139.7;
this.addMouseListener(this);
}
public void paint( Graphics g ) {
str="http://maps.google.com/maps/api/staticmap?center=";
str=str+w;
str=str+",";
str=str+h;
str=str+"&zoom=12&size=400x400&sensor=false";
try {
URL url = new URL(str);
img = Toolkit.getDefaultToolkit().getImage(url);
} catch (MalformedURLException ex) {ex.printStackTrace();}
g.drawImage(img,0,0,700,700,this);
}
public void mouseClicked(MouseEvent e) {
double mex,mey;
mey=e.getY() ;
mex=e.getX();
if(mex>350)h=h-0.01;
if(mex<350)h=h+0.01;
if(mey>350)w=w+0.01;
if(mey<350)w=w-0.01;
repaint();
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
}
最終更新:2011年07月31日 11:39