gui.java

来自「JAVA源代码程序aashjkjhkjhkjhjkhkj」· Java 代码 · 共 85 行

JAVA
85
字号
// Gui class (main program)// =========import java.awt.*;import java.awt.event.*;import java.io.*;import java.util.*;public class Gui extends Frame implements WindowListener, ActionListener{	// link to directory component	static DirBase	dirBase;	// application window components	Button	dirButton, doneButton;	DirGui	myDirGui;	public Gui() // Constructor	{		super("Java Personal Organiser");		setup();	}	// setup the window for the application	public void setup()	{		//resize(300,60);		setSize(300,60);		setLayout(new GridLayout(1,2));		dirButton = new Button("directory");		doneButton = new Button("done");		add(dirButton);		add(doneButton);		dirButton.addActionListener(this);		doneButton.addActionListener(this);		show();		myDirGui = new DirGui(dirBase);	} // end of method "setup"	// Process actions	public void actionPerformed (ActionEvent event)	{		if (event.getSource() == doneButton)		{			dirBase.close();			// shutdown the program			System.exit(0);		}		else if (event.getSource() == dirButton)		{			myDirGui.show();		}	} // end of method "actionPerformed"	public static void main(String[] args) throws IOException	{		dirBase = new DirBase("telinfo");		Gui myGui = new Gui();	} // end of method "main"	public void windowOpened(WindowEvent event) {}        public void windowIconified(WindowEvent event) {}        public void windowDeiconified(WindowEvent event) {}        public void windowClosed(WindowEvent event) {}        public void windowActivated(WindowEvent event) {}        public void windowDeactivated(WindowEvent event) {}	public void windowClosing(WindowEvent event)	{	dispose();	System.exit(0);	} // end of method "windowClosing"} // end of Gui

⌨️ 快捷键说明

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