帮忙看一下这段Java代码

来源:百度知道 编辑:UC知道 时间:2024/06/08 14:42:58
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class JTGraphicsApp
{
public static void main(String ar[])
{
new FrameInOut ();
}
}

class FrameInOut extends Frame implements ActionListener
{

TextField input,output;
Image myImage;
Font myFont=new Font("黑体",Font.BOLD,20);
Color myColor=new Color(120,25,180);
Label myLab;
Button btn1,btn2,btn3;

FrameInOut()
{
super("08国际重大事件竞猜");
myLab=new Label("请输入答案:");
myImage=new ImageIcon("niaochao.jpg").getImage();
input=new TextField(6);
output=new TextField(20);
btn1=new Button("下一题");
btn2=new Button("关闭");
btn3=new Button("确定");

setLayout(new FlowLayout());
add(myLab);
add(input);
add(output);
add(btn1);
add(btn2);

if (s[0].equals(t[0]))改为if (s[0].equals(t[0])||s[0].equals(t[1]))
这样不就OK了嘛!!

在我的机子上用命令行调试没错,主要把中文换成英文就可以了,还有文件保存的编码类型为ANSIC。。如果在netbeans等IDE上就可以支持中文。。。。