try
1.
import java.applet.Applet;
import java.awt.*;
import java.lang.*;public class MyApplet2 extends Applet
{
String m_str;
public void init(){
m_str="test";
// resize(30,40);
}
public void paint(Graphics g)
{
g.setColor(Color.red);
g.drawString("now is the test ClassData:",10,20);
g.drawString(m_str,10,40);
}
}2.
<html>
<body>
<applet code="MyApplet2.class" width="200" height="200">
</applet>
</body>
</html> 3. because IE might not have the latest JVM, use
c:\>AppletViewer yourhtml.html
1.
import java.applet.Applet;
import java.awt.*;
import java.lang.*;public class MyApplet2 extends Applet
{
String m_str;
public void init(){
m_str="test";
// resize(30,40);
}
public void paint(Graphics g)
{
g.setColor(Color.red);
g.drawString("now is the test ClassData:",10,20);
g.drawString(m_str,10,40);
}
}2.
<html>
<body>
<applet code="MyApplet2.class" width="200" height="200">
</applet>
</body>
</html> 3. because IE might not have the latest JVM, use
c:\>AppletViewer yourhtml.html
在html所在的路径下建一个XXX目录,然后
<applet code="XXX.MyApplet2.class" width="200" height="200" codebase=".">
那么现在应该可以看到想要的内容了。
的确,有输出,只是我没看到!
那我问一下,drawString中的x,y是以象素点为单位吗?
还是字符行数