程序运行后界面如下:
import java.awt.*; import java.awt.event.*; //*********Found******** public class Java_3 implements ActionListener, ________________ { Frame f; Button be, bw, bs, bn, bc; public void create() { //*********Found******** f = ________________; be = new Button("East"); //*********Found******** bw = new Button(________________); bs = new Button("South"); bn = new Button("North"); bc = new Button("Exit"); //*********Found******** f.add(be, ________________); f.add(bw, "West"); f.add(bs, "South"); f.add(bn, "North"); f.add(bc, "Center"); bc.addActionListener(this); //为按钮注册监听器 f.addWindowListener(this); //为按钮注册监听器 f.setSize(200, 200); //*********Found******** f.setVisible(________________); } public static void main(String args[]) { Java_3 fa = new Java_3(); fa.create(); } public void actionPerformed(ActionEvent e) { System.exit(0); //实现窗口关闭功能 } public void windowOpened(WindowEvent e) { } public void windowClosing(WindowEvent e) { System.exit(0); //实现窗口关闭功能 } public void windowClosed(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } }