import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class string4 extends Applet implements TextListener{
Label lblMessage;
TextField txtText1;
String strString1="";
Font fntFont=new Font("Georgia",Font.Bold,20);
public void init(){
lblMessage=new Label("enter some words");
add(lblMessage);
txtText1=new TextField(20);
add(txtText1);
txtText1.addTextListener(this);
}
public void paint(Graphics objG){
objG.setFont(fntFont);
objG.drawString="strString 1,202,62";
}
public void textValueChanged(TextEvent objE){
strString1=txtText1.getText();
}
}
这是已编辑的,我试过了,但仍然有错误这是 cmd 所说的 C:\sample java>javac string4.java string4.java:8: 找不到符号符号:变量粗体位置:类 java.awt。 Font Font fntFont=new Font("Georgia",Font.Bold,20);
string4.java:18:找不到符号符号:变量 drawString 位置:类 java.awt.Graphics objG.drawString="strString 1,202,62";
2 个错误