求解此迷宫的java源代码的意思 最好一句一句的注释 最好快点 5
importjavax.swing.*;importjava.awt.*;publicclassPersonInMazeextendsJTextField{MazePoi...
import javax.swing.*;
import java.awt.*;
public class PersonInMaze extends JTextField{
MazePoint point;
Toolkit tool;
PersonInMaze(){
tool=getToolkit();
setEditable(false);
setBorder(null);
setOpaque(false);
setToolTipText("单击我,然后按键盘方向键");
}
public void setAtMazePoint(MazePoint p){
point=p;
}
public MazePoint getAtMazePoint(){
return point;
}
public void paintComponent(Graphics g){
super.paintComponent(g);
int w=getBounds().width;
int h=getBounds().height;
Image image=tool.getImage("person.gif");
g.drawImage(image,0,0,w,h,this);
}
} 展开
import java.awt.*;
public class PersonInMaze extends JTextField{
MazePoint point;
Toolkit tool;
PersonInMaze(){
tool=getToolkit();
setEditable(false);
setBorder(null);
setOpaque(false);
setToolTipText("单击我,然后按键盘方向键");
}
public void setAtMazePoint(MazePoint p){
point=p;
}
public MazePoint getAtMazePoint(){
return point;
}
public void paintComponent(Graphics g){
super.paintComponent(g);
int w=getBounds().width;
int h=getBounds().height;
Image image=tool.getImage("person.gif");
g.drawImage(image,0,0,w,h,this);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询