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

📄 borderedcanvas.java

📁 使用java application 的共享白板系统
💻 JAVA
字号:
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;

public class BorderedCanvas extends JPanel {
	// Clip the graphics context to exclude the border
	protected void excludeBorder(Graphics g, Border border, int width, int height) {
		Rectangle r = AbstractBorder.getInteriorRectangle(this, border, 
										0, 0, width, height);
		g.clipRect(r.x, r.y, r.width, r.height);		
	}

	// Override getGraphics() to clip for derived class
	public Graphics getGraphics() {
		Dimension d = getSize();

		Graphics g = super.getGraphics();

		Border border = getBorder();
		if (border != null) {
			excludeBorder(g, border, d.width, d.height);
		}

		return g;
	}	
}

⌨️ 快捷键说明

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