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

📄 clipped.java

📁 exploring Java 2ed edition 附带的例子程序
💻 JAVA
字号:
import java.awt.*;import java.awt.event.*;public class Clipped extends TerribleFlicker { 	int nextX, nextY;		public void mouseDragged( MouseEvent e ) {		nextX = e.getX(); nextY = e.getY();		repaint();	}	void clipToAffectedArea( Graphics g, int oldx, int oldy, int newx, 										int newy, int width, int height) {		int x = Math.min( oldx, newx );		int y = Math.min( oldy, newy );		int w = ( Math.max( oldx, newx ) + width ) - x;		int h = ( Math.max( oldy, newy ) + height ) - y;		g.setClip( x, y, w, h );	}	public void update( Graphics g ) {		int lastX = currentX, lastY = currentY;		currentX = nextX; currentY = nextY;		clipToAffectedArea( g, lastX, lastY, currentX, currentY, imgWidth, imgHeight );		paint( g );	}}

⌨️ 快捷键说明

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