关键字:Draw2d 连线 Locator ConnectionEndpointLocator
public class HelloWorld2 {
public static void main(String args[]) {
Shell shell = new Shell();
shell.setText("Draw2d Hello World");
shell.setSize(300, 300);
shell.open();
// create content 4 shell.
createContent4Shell(shell);
while (!shell.isDisposed ()) {
if (!Display.getDefault().readAndDispatch ())
Display.getDefault().sleep ();
}
}
private static void createContent4Shell(Shell shell) {
Panel rootFigure = new Panel();
rootFigure.setLayoutManager(new XYLayout());
IFigure figure1 = new Ellipse();
Ellipse figure2 = new Ellipse();
// --------------------------------------------------------
// add connection
PolylineConnection connection = new PolylineConnection();
connection.setSourceAnchor(new ChopboxAnchor(figure1));
connection.setTargetAnchor(new EllipseAnchor(figure2));
// --------------------------------------------------------
// add Decoration to Connection
connection.setSourceDecoration(new PolygonDecoration());
// --------------------------------------------------------
// add Labels to Connection
ConnectionEndpointLocator Locator1 = new ConnectionEndpointLocator(connection, true);
Locator1.setVDistance(30);
connection.add(new Label("1..*"), Locator1);
ConnectionEndpointLocator Locator2 = new ConnectionEndpointLocator(connection, false);
Locator2.setVDistance(15);
connection.add(new Label("22..*"), Locator2);
ConnectionEndpointLocator Locator3 = new ConnectionEndpointLocator(connection,true);
Locator3.setUDistance(80);
Locator3.setVDistance(-20);
connection.add(new Label("3333..*"),Locator3);
rootFigure.add(figure1,new Rectangle(10,10,60,30));
rootFigure.add(figure2,new Rectangle(170,170,90,90));
rootFigure.add(connection);
LightweightSystem lws = new LightweightSystem(shell);
lws.setContents(rootFigure);
}
}
ConnectionEndpointLocator在定位时非常的方便。setUDistance表示到图像的距离,setVDistance表示到线的距离。
- 大小: 7.1 KB
分享到:
相关推荐
赠送jar包:osgi-resource-locator-1.0.1.jar; 赠送原API文档:osgi-resource-locator-1.0.1-javadoc.jar; 赠送源代码:osgi-resource-locator-1.0.1-sources.jar; 赠送Maven依赖信息文件:osgi-resource-locator...
安装labview之后,如何解决NI service locator is not running
赠送jar包:hk2-locator-2.4.0-b34.jar; 赠送原API文档:hk2-locator-2.4.0-b34-javadoc.jar; 赠送源代码:hk2-locator-2.4.0-b34-sources.jar; 赠送Maven依赖信息文件:hk2-locator-2.4.0-b34.pom; 包含翻译后...
Laravel开发-locator 一个简单的本地路由器。
selenium xpath webdriver_element locator webdriver_element_locator-1.rev312-fx.xpi work with firefox version 19-37
oracle.jdbc-driver-locator.jar
selenium自动化测试,对象识别神器。Firefox插件element-locator-for-webdriv;(FirefoxSetup35.0.1chs.exe适用)
这是一个互联网根据IP和域名定位的源代码,可以根据IP地址和制定域名获取相关的信息,如所属国家、地区、时区、互联网服务提供商(Isp)、经纬度等。同时利用Google地图自动显示该IP所处的地理位置。...
Autofac的ServiceLocator模式应用,零配置
WebJarAssetLocator locator = new WebJarAssetLocator(); String fullPathToRequirejs = locator.getFullPath("require.js"); 获取基本文件夹中的所有资产 WebJarAssetLocator locator = new WebJarAssetLocator...
Firefox浏览器xpath插件webdriver_element_locator-1.rev312-fx.xpi
wifi破解 专用软件
统一资源定位符(URL,英语Uniform Resource Locator的缩写)也被称为网页地址,是因特网上标准的资源的地址。它最初是由蒂姆•伯纳斯-李发明用来作为万维网的地址的。现在它已经被万维网联盟编制为因特网标准RFC...
赠送jar包:osgi-resource-locator-1.0.1.jar; 赠送原API文档:osgi-resource-locator-1.0.1-javadoc.jar; 赠送源代码:osgi-resource-locator-1.0.1-sources.jar; 赠送Maven依赖信息文件:osgi-resource-locator...
赠送jar包:hk2-locator-2.4.0-b34.jar; 赠送原API文档:hk2-locator-2.4.0-b34-javadoc.jar; 赠送源代码:hk2-locator-2.4.0-b34-sources.jar; 赠送Maven依赖信息文件:hk2-locator-2.4.0-b34.pom; 包含翻译后...
检索IP所在地/查询域名归属是我们上网过程中经常打交道的一桩事,也许您已为此在收藏夹中准备了不少相关的查询网站、或是同时安装了多款 Whois 客户端等,而 Domain IP Locator 正是为提高您完成这些日常操作的效率...
Locatable是一个Swift微框架,它利用Property Wrappers通过自定义属性@Locatable实现Service Locator模式
Locator-micro 是定位器的微模板编译器。此组件可以与雅虎编译微定位器组件集成模板。在默认情况下,它支持 YUI 格式,使用 YAF 模版。编译后的模版可通过模块加载程序用于服务器和客户端,切该模块加载程序取决于...