Topic: 在jcreator里编程。。大侠指教

  Print this page

1.在jcreator里编程。。大侠指教 Copy to clipboard
Posted by: kittyyyl
Posted on: 2004-09-10 01:59

程序如下
import java.awt.*;
import java.awt.image.*;
import java.applet.*;
public class test extends Applet{
private Image Img;
private int intFontSize;
public void init(){
String strImgFile=getParameter("img");
Img=getImage(getCodeBase(),strImgFile);
String strFontSize=getParameter("fontSize");
intFontSize=Integer.parseInt(strFontSize);
log("小程序初始化完毕。。。");
}
public void start(){
log("小程序运行。。。");
}
public void stop(){
log("小程序停止。。");
}
public void destroy(){
log("小程序销毁。。");
}
public void paint(Graphics g){
log("绘图。。");
g.drawImage(Img,0,0,getSize().width,getSize().height,this);
log("设置绘图颜色。。");
g.setColor(Color.black);
log("创建字体对象。。");
Font f=new Font("Monospaced",Font.BOLD,intFontSize);
log("设置绘图字体。。");
g.setFontRose;
log("写字。。");
g.drawString("这是一个测试",30,150);
}
public void log(String strInfo){
System.out.println(strInfo);
}
}
同样一个程序如果将他存在jcreator默认目录里面可以通过编译
但要是换了个存储路径就不能通过编译了提示
--------------------Configuration: JDK version 1.5.0 <Default>--------------------
E:\java\Applet.java:4: class test is public, should be declared in a file named test.java
public class test extends Applet{
^
E:\java\test.java:4: cannot access Applet
bad class file: E:\java\Applet.java
file does not contain class Applet
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class test extends Applet{
^
2 errors

Process completed.

是不是要改下路径?该怎么办?应该跟import有关把?

2.Re:在jcreator里编程。。大侠指教 [Re: kittyyyl] Copy to clipboard
Posted by: flywithmoon
Posted on: 2004-09-10 14:28

该不会是你该了个文件名吧,不能随便换文件名的。

3.Re:在jcreator里编程。。大侠指教 [Re: kittyyyl] Copy to clipboard
Posted by: Donnyzhao
Posted on: 2004-09-10 18:07

我在我的机子上试没有报错。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923