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

📄 clearal.java

📁 用JAVA写的画图软件
💻 JAVA
字号:
package graphInterface;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class ClearAL implements ActionListener{
	
	private JPanel sourcePanel;

	private JPanel infoPanel;

	public ClearAL(JPanel sp, JPanel ip) {
		sourcePanel = sp;
		infoPanel = ip;
	}

	public void actionPerformed(ActionEvent ae) {
		// 清除对象面板内容
		Graphics sgra = sourcePanel.getGraphics();
		sgra.setColor(sourcePanel.getBackground());
		sgra.fillRect(0, 0, 1000, 1000);
		// 清除信息面板内容
		Graphics igra = infoPanel.getGraphics();
		igra.setColor(infoPanel.getBackground());
		igra.fillRect(0, 0, 1000, 1000);
		// 清除对象面板的鼠标监听器
		MouseListener[] al = sourcePanel.getMouseListeners();
		for (int i = 0; i < al.length; ++i) {
			sourcePanel.removeMouseListener(sourcePanel.getMouseListeners()[i]);
			sourcePanel.removeMouseMotionListener(sourcePanel
					.getMouseMotionListeners()[i]);
		}
	}
}

⌨️ 快捷键说明

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