Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 在jcreator里编程。。大侠指教
kittyyyl





发贴: 12
积分: 0
于 2004-09-10 01:59 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
程序如下
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有关把?




话题树型展开
人气 标题 作者 字数 发贴时间
3225 在jcreator里编程。。大侠指教 kittyyyl 1708 2004-09-10 01:59
2390 Re:在jcreator里编程。。大侠指教 flywithmoon 23 2004-09-10 14:28
2526 Re:在jcreator里编程。。大侠指教 Donnyzhao 13 2004-09-10 18:07

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   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