I am working on creating an editor as part of a lager JAVA application that would allow the user to drag and drop different custom Swing components onto a panel (just like a GUI editor). I also want to have the user able to rotate these objects by the mouse. I have been looking at JXLayer and TransformUI, but I don't want t开发者_C百科o add a whole bunch of libraries. Any ideas?
You could also consider to build your application on top of the NetBeans Platform (a Swing based RCP) and use its Visual Library:
http://platform.netbeans.org/graph/
I've created a customizer framework for such tasks: Move and resize components with the mouse and allow further customizations. "Snap-to-grid"-feature included! Maybe you find it useful. (It's open source!)
I started to write a tutorial (still under construction!):
http://softsmithy.sourceforge.net/lib/docs/tutorial/swing/customizer/index.html
For adding components see:
http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/CustomizerBar.html
To customize properties use:
http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/JCustomizerPropertyTable.html
Register it to the SelectionManager of the JCustomizerPane and set the CustomizableProperties-property of the JCustomizer objects.
Also have a look at the subclasses of JCustomizer.
E.g. there are
customizers for images & shapes:
http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/JXIconCustomizer.html
a label customizer with inline editing:
http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/JLabelCustomizer.html
a line customizer:
http://softsmithy.sourceforge.net/lib/docs/api/org/softsmithy/lib/swing/JLine2DCustomizer.html
And there are many classes providing support for menu- and toolbar-actions. (Incuding support for some of the "Java Look and Feel Graphics Repository" actions.)
Look at the *.swing and the *.swing.action packages.
Just ask me if you don't find them.
Homepage:
http://www.softsmithy.org
Download:
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
If you have questions just ask me!
精彩评论