📄 gui.java
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -