Netbeans7.2为何不识别中文?
package newpackage;
import java.awt.*;
import java.awt.event.*;
import java.util.Random;
public class NumberGame extends Frame {
Button btn;
TextField txt;
Label lbl;
Random ram=new Random();
int number=ram.nextInt(1000);
public NumberGame()
{
setLayout(null);
btn=new Button("是");
btn.setLocation(100,100);
btn.setSize(80,20);
class BtnClick implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
int n=Integer.parseInt(txt.getText());
if(n>number) {
lbl.setText("你输入的数字偏大");
}
else if(n<number) {
lbl.setText("你输入的数字偏小");
}
else if(n==number) {
lbl.setText("恭喜你,猜对了");
}
}
}
BtnClick bc=new BtnClick();
btn.addActionListener(bc);
add(btn);
txt=new TextField();
txt.setLocation(200,100);
txt.setSize(100,20);
add(txt);
lbl=new Label();
lbl.setLocation(100,130);
lbl.setSize(100,20);
add(lbl);