⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.java

📁 用java写的一段PL0编译程序.用户可以在文本框内输入一段PL0代码
💻 JAVA
字号:
import com.ms.wfc.app.*;
import com.ms.wfc.core.*;
import com.ms.wfc.ui.*;
import com.ms.wfc.html.*;

/**
 * This class can take a variable number of parameters on the command
 * line. Program execution begins with the main() method. The class
 * constructor is not invoked unless an object of type 'Form1'
 * created in the main() method.
 */
public class Form1 extends Form
{
	public Form1()
	{
		super();

		// Required for Visual J++ Form Designer support
		initForm();		

		// TODO: Add any constructor code after initForm call
	}

	/**
	 * Form1 overrides dispose so it can clean up the
	 * component list.
	 */
	public void dispose()
	{
		super.dispose();
		components.dispose();
	}

	private void edit1_textChanged(Object source, Event e)
	{
		
	}

	private void doit_click(Object source, Event e)
	{
		Injunction in;
		lb_objcode.removeAll();
		if(!new Grammer(edit_source.getText(),this).startwork())
			return;
		for(int i=0;i<Glb.ObjCode.size();i++)
		{
			in=(Injunction)Glb.ObjCode.elementAt(i);
			lb_objcode.addItem(""+i+":"+InType.get_instr(in.cmd)+"  "+in.A1+"  "+in.A2);
		}
		
	}

	/**
	 * NOTE: The following code is required by the Visual J++ form
	 * designer.  It can be modified using the form editor.  Do not
	 * modify it using the code editor.
	 */
	Container components = new Container();
	Edit edit_source = new Edit();
	ListBox lb_objcode = new ListBox();
	Button doit = new Button();

	private void initForm()
	{
		this.setText("Form1");
		this.setAutoScaleBaseSize(new Point(6, 12));
		this.setClientSize(new Point(424, 344));

		edit_source.setLocation(new Point(8, 8));
		edit_source.setSize(new Point(280, 272));
		edit_source.setTabIndex(0);
		edit_source.setText("");
		edit_source.setMultiline(true);
		edit_source.addOnTextChanged(new EventHandler(this.edit1_textChanged));

		lb_objcode.setLocation(new Point(296, 8));
		lb_objcode.setSize(new Point(121, 328));
		lb_objcode.setTabIndex(1);
		lb_objcode.setText("listBox1");
		lb_objcode.setUseTabStops(true);

		doit.setLocation(new Point(8, 288));
		doit.setSize(new Point(280, 48));
		doit.setTabIndex(2);
		doit.setText("语法分析");
		doit.addOnClick(new EventHandler(this.doit_click));

		this.setNewControls(new Control[] {
							doit, 
							lb_objcode, 
							edit_source});
	}

	/**
	 * The main entry point for the application. 
	 *
	 * @param args Array of parameters passed to the application
	 * via the command line.
	 */
	public static void main(String args[])
	{
		Application.run(new Form1());
	}
}

⌨️ 快捷键说明

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