用Frame实现的画的播放,部分代码:
public static void main(String [] args){
Frame f = new Frame("卡片式布局");
CardLayout c = new CardLayout();
f.setLayout(c);
Image im [] = new Image[4];
for(int i=0;i<4;i++){
im[i] = getImage(getDocumentBase(),"images\\"+i+".jpg");
f.add(im[i],"page"+i);
}
用getImage(getDocumentBase()添加图片出错,报错“The method getDocumentBase() is undefined for the type TestCarLayout”,不知道是怎么回事???
public static void main(String [] args){
Frame f = new Frame("卡片式布局");
CardLayout c = new CardLayout();
f.setLayout(c);
Image im [] = new Image[4];
for(int i=0;i<4;i++){
im[i] = getImage(getDocumentBase(),"images\\"+i+".jpg");
f.add(im[i],"page"+i);
}
用getImage(getDocumentBase()添加图片出错,报错“The method getDocumentBase() is undefined for the type TestCarLayout”,不知道是怎么回事???
java.awt.Toolkit 的 getImage方法