GUI编程(2)事件监听(按钮)
监视动作以做出反应
package com.Jiu;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Notto2 {
public static void main(String[] args) {
//按下按钮触发一些事件
Frame frame1 = new Frame();
frame1.setLayout(new FlowLayout(FlowLayout.CENTER));
Button button1 = new Button("button");
Button button2 = new Button();
frame1.setSize(300,300);
frame1.setLocation(200,200);
frame1.setVisible(