当前位置: 技术问答>java相关
50分问个不算复杂的问题!
来源: 互联网 发布时间:2014-12-29
本文导语: 文件Draw.java import java.applet.*; import java.awt.*; import java.util.*; public class Draw extends Applet { Image board,chessman; Bpnl pnl; Vector vc; public void init() { board=getImage(getCodeBase(),"board.jpg"); chessman=getImage(...
文件Draw.java
import java.applet.*;
import java.awt.*;
import java.util.*;
public class Draw extends Applet {
Image board,chessman;
Bpnl pnl;
Vector vc;
public void init() {
board=getImage(getCodeBase(),"board.jpg");
chessman=getImage(getCodeBase(),"chessman.jpg");
vc=new Vector();
vc.addElement(board);
vc.addElement(chessman);
pnl=new Bpnl(vc);
}
}
class Bpnl extends Panel {
Vector bv;
public void Bpnl(Vector vb) {
bv=vb;
}
public void paint(Graphics g) {
for(int i=0;ijavac Draw.java
Draw.java:15: 不能解析符号
符号:构造方法 Bpnl (java.util.Vector)
位置:类 in Bpnl
pnl=new Bpnl(vc);
^
Draw.java:27: 不能解析符号
符号:方法 drawImage (java.lang.Object,int,int,Bpnl)
位置:类 in java.awt.Graphics
g.drawImage(bv.get(i),0,0,this);
^
2 个错误
import java.applet.*;
import java.awt.*;
import java.util.*;
public class Draw extends Applet {
Image board,chessman;
Bpnl pnl;
Vector vc;
public void init() {
board=getImage(getCodeBase(),"board.jpg");
chessman=getImage(getCodeBase(),"chessman.jpg");
vc=new Vector();
vc.addElement(board);
vc.addElement(chessman);
pnl=new Bpnl(vc);
}
}
class Bpnl extends Panel {
Vector bv;
public void Bpnl(Vector vb) {
bv=vb;
}
public void paint(Graphics g) {
for(int i=0;ijavac Draw.java
Draw.java:15: 不能解析符号
符号:构造方法 Bpnl (java.util.Vector)
位置:类 in Bpnl
pnl=new Bpnl(vc);
^
Draw.java:27: 不能解析符号
符号:方法 drawImage (java.lang.Object,int,int,Bpnl)
位置:类 in java.awt.Graphics
g.drawImage(bv.get(i),0,0,this);
^
2 个错误
|
修改后的Bpnl
class Bpnl extends Panel {
Vector bv;
public Bpnl(Vector vb) { ///
bv=vb;
}
public void paint(Graphics g) {
for(int i=0;i
class Bpnl extends Panel {
Vector bv;
public Bpnl(Vector vb) { ///
bv=vb;
}
public void paint(Graphics g) {
for(int i=0;i