Topic: [求助]郁闷ing(cannot resolve symbol)

  Print this page

1.[求助]郁闷ing(cannot resolve symbol) Copy to clipboard
Posted by: 火山一角
Posted on: 2005-10-06 10:19

请尽量使用准确的文字描述作为标题
若新帖再無恰当标题,可能会被刪除
Original subject :
[求助]郁闷ing


各位大虾帮忙看一下,以下是我从课本上抄写的一个小程序

import java.awt.Graphics;
import java.applet.Applet;
public class My extends Applet
{
public Strings s;
public void init()
{
s=new String("Hello World");
}
public void paint(Graphics g)
{
g.drawString(s,25,25);
}
}

没有想到在运行时居然出了错误.Sad

2.Re:[求助]郁闷ing [Re: 火山一角] Copy to clipboard
Posted by: andykid
Posted on: 2005-10-06 10:28

public Strings s;

改成public String s;试试?

3.Re:[求助]郁闷ing [Re: 火山一角] Copy to clipboard
Posted by: 火山一角
Posted on: 2005-10-06 11:06

改了,运行能够通过,编译不能成功.系统出现如下提示:


200kb bmp file removed -- in fact, the file doesn't have the extension bmp
Please cut and paste the message from the Command Prompt window rather than posting an image.


4.Re:[求助]郁闷ing [Re: 火山一角] Copy to clipboard
Posted by: truthawp
Posted on: 2005-10-06 18:48

HTML文档没写,这是APPLET哦

5.Re:[求助]郁闷ing(cannot resolve symbol) [Re: 火山一角] Copy to clipboard
Posted by: 火山一角
Posted on: 2005-10-06 21:24

写好了,而且就放在同一个文件夹下.内容如下:
<HTML>
<HEAD>
<TITLE>我的第一个Applet程序</TITLE>
</HEAD>
<BODY>
<APPLET CODE="My.class" WIDTH=200 HEIGHT=100>
</APPLET>
</BODY>
</HTML>

6.Re:[求助]郁闷ing(cannot resolve symbol) [Re: 火山一角] Copy to clipboard
Posted by: YuLimin
Posted on: 2005-10-06 22:49

1、My.java文件内容:

import java.awt.Graphics;
import java.applet.Applet;
public class My extends Applet
{
public String s;
public void init()
{
s=new String("Hello World");
}
public void paint(Graphics g)
{
g.drawString(s,25,25);
}
}


2、编译时加上开关条件
javac -target 1.1 My.java

3、My.html
<HTML>
<HEAD>
<TITLE>我的第一个Applet程序</TITLE>
</HEAD>
<BODY>
<APPLET CODE="My.class" WIDTH=200 HEIGHT=100>
</APPLET>
</BODY>
</HTML>

4、查看效果AppletViewer My.html


   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