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

📄 testapplet.java

📁 corejava的一部分源码,与corejiavasource中的有区别。
💻 JAVA
字号:
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;

public class TestApplet extends Applet {
	Dialog d = new DeadlockDialog();

	public void init() {
		addMouseListener(new MouseAdapter() {
			public synchronized void mousePressed(MouseEvent e) {
				try {
					Thread.currentThread().sleep(2000);
				}
				catch(InterruptedException ex) {
					ex.printStackTrace();
				}
				d.setVisible(true);
			}
		});
	}
	public void paint(Graphics g) {
		g.drawString("click in here twice in a row " +
					 "within a span of 2 seconds", 20, 20);
	}
}
class DeadlockDialog extends Dialog {
	Button doneButton = new Button("doneButton");

	public DeadlockDialog() {
		super(new Frame(), "Deadlock", true);
		add(doneButton);
		pack();

		doneButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});
	}
}

⌨️ 快捷键说明

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