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

📄 goodidea.java

📁 翁剀JAVA语言那门课程的教案 很多人都看多他的视频教程可惜没有ppt的教案
💻 JAVA
字号:
//: GoodIdea.java
// The best way to design classes using the new
// Java 1.1 event model: use an inner class for
// each different event. This maximizes
// flexibility and modularity.
import java.awt.*;
import java.awt.event.*;
import java.util.*;

public class GoodIdea extends Frame {
	Button
		b1 = new Button("Button 1"),
		b2 = new Button("Button 2");

	public GoodIdea() {
		setLayout(new FlowLayout());
		b1.addActionListener(new B1L());
		b2.addActionListener(new B2L());
		add(b1);
		add(b2);
	}

	public class B1L implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			System.out.println("Button 1 pressed");
		}
	}
	
	public class B2L implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			System.out.println("Button 2 pressed");
		}
	}
	
	public static void main(String[] args) {
		Frame f = new GoodIdea();
		f.addWindowListener(
		new WindowAdapter() {
			public void windowClosing(WindowEvent e){
				System.out.println("Window Closing");
				System.exit(0);
			}
		});
		f.setSize(300,200);
		f.setVisible(true);
	}
} ///:~

⌨️ 快捷键说明

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