📄 yyy.java.bak
字号:
import java.io.*;
import java.awt.*;
import java.awt.event.*;
public class yyy
{
public static void main(String args[])
{
new open();
}
}
class open extends Frame implements ActionListener
{
Label prompt,prompt1;
TextField input,output;
Button btn,btn1;
String line1,line;
open()
{
super("The striving after better hopes");
prompt=new Label("Welcome to");
prompt1=new Label("请输入问题:");
input=new TextField(20);
output=new TextField(20);
btn=new Button("回答");
btn1=new Button("关闭");
setLayout(new FlowLayout());
add(prompt);
add(prompt1);
add(input);
add(output);
add(btn);
add(btn1);
btn.addActionListener(this);
btn1.addActionListener(this);
setSize(200,200);
show();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==btn)
try{
FileReader File1 =new FileReader("c:\\aaa\\R1.txt");
BufferedReader buff=new BufferedReader(File1);
line1=input.getText();
while((line=buff.readLine())!= null)
{
if(line.equals(line1))
{
line = buff.readLine();
output.setText(line);
}
}
File1.close();
buff.close ();
}catch (Exception sza){}
else
{
dispose();
System.exit(0);
}
try{
FileReader File1 =new FileReader("c:\\connely\\R1.txt");
BufferedReader buff=new BufferedReader(File1);
line = buff.readLine();
if(line==null)
output.setText("sorry I don`t know");
}catch (Exception asd){}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -