我正在创建一个编辑器,作为大型JAVA应用程序的一部分,该应用程序允许用户将不同的自定义Swing组件拖放到面板上(就像GUI编辑器一样)。我还希望用户能够通过鼠标旋转这些对象。我一直在研究JXLayer和TransformUI,但我不想添加一大堆库。有什么想法吗?
您还可以考虑在NetBeans平台(一个基于Swing的RCP)之上构建应用程序,并使用其Visual Library:
http://platform.netbeans.org/graph/
我已经为这些任务创建了一个自定义框架:用鼠标移动和调整组件大小,并允许进一步的自定义。"捕捉到网格"-包括功能!也许你觉得它有用。(这是开源的!)
我开始写教程(仍在建设中!):
http://softsmithy.sourceforge.net/lib/docs/tutorial/swing/customizer/index.html
有关添加组件,请参阅:
http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/CustomizerBar.html
要自定义属性,请使用:
http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/JCustomizerPropertyTable.html
将其注册到JCustomizerPane的SelectionManager中,并设置JCustomizer对象的CustomizableProperties属性。
还可以看看JCustomizer的子类。
例如,有
用于图像的定制器&形状:
http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/JXIconCustomizer.html
具有内联编辑功能的标签定制器:
http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/JLabelCustomizer.html
一个线路定制器:
http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/JLine2DCustomizer.html
还有许多类提供对菜单和工具栏操作的支持。(包括对一些"Java外观图形库"操作的支持。)
看看*.swing和*.swing.action包。
如果你找不到他们就问问我。
主页:
http://www.softsmithy.org
下载:
http://sourceforge.net/projects/softsmithy/files/softsmithy/
Maven:
<dependency>
<groupid>org.softsmithy.lib</groupid>
<artifactid>lib-core</artifactid>
<version>0.1</version>
</dependency>
API:
http://softsmithy.sourceforge.net/lib/docs/api/index.html
如果你有问题,直接问我!