eventdo.java

来自「可以实现.txt和.pas文件的词法分析,提供给大家参考和学习」· Java 代码 · 共 38 行

JAVA
38
字号
package PL0;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;

public class EventDo extends JFrame{
	public static JButton open=new JButton("打开文件");
	public static JButton symdo=new JButton("开始处理");
	public static JTextArea filecontent=new JTextArea(23,53);
	public static JTextField filename=new JTextField();
	public static JTextArea errorinfor=new JTextArea(5,53);
	public EventDo(){
		JPanel p=new JPanel();
		filename.setEditable(false);
		errorinfor.setEditable(false);
		p.setLayout(new GridLayout(1,3));
		p.add(open);
		p.add(filename);
		p.add(symdo);
		JPanel p1=new JPanel();
		p1.add(new JScrollPane(filecontent),BorderLayout.NORTH);
		p1.add(new JScrollPane(errorinfor));
		add(p1);
		add(p,BorderLayout.NORTH);
	}
    public  static void openfile(String filename) throws IOException{
	    BufferedReader in=new BufferedReader(new FileReader(filename));
	    String s;
	    int i=0;
		while((s=in.readLine())!=null){
			filecontent.append(i+"       "+s+"\n");
			i++;
		}
		in.close();
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?