boundingbox.java

来自「这是一款基于PlaceLab软件开发的导航系统中间件的客户端程序.」· Java 代码 · 共 46 行

JAVA
46
字号
package org.placelab.demo.mapview;import org.eclipse.swt.SWT;import org.eclipse.swt.events.PaintEvent;import org.eclipse.swt.events.PaintListener;import org.eclipse.swt.graphics.GC;import org.eclipse.swt.graphics.Rectangle;import org.eclipse.swt.widgets.Composite;/** *  * */public class BoundingBox extends Composite {	public BoundingBox(Composite parent) {		super(parent,SWT.NO_BACKGROUND);//		addPaintListener(new SimplePaintListener());	}		public void paintSelf(GC gc) {		Rectangle bounds=getBounds();		gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLUE));		gc.drawOval(0,0,bounds.width-1,bounds.height-1);		gc.drawRectangle(0,0,bounds.width-1,bounds.height-1);	}		class SimplePaintListener implements PaintListener {		public void paintControl(PaintEvent e) {			if (getVisible()) {								GC gc=e.gc;								Rectangle bounds=getBounds();				gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLUE));//				gc.drawOval(0,0,bounds.width-1,bounds.height-1);				gc.drawRectangle(0,0,bounds.width-1,bounds.height-1);			}					}	}		}

⌨️ 快捷键说明

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