movable components in Panel

I have a panel, in which I have to place few components which should be movable at run time...Its similar to what IDEs like NetBeans do..when the component is placed on the panel, we will be able to drag and place wherever we like..I would like to acheive the same during runtime.

Can someone help me with this.

Thanks in advance

Pradeep

[362 byte] By [pradeep@echa] at [2007-11-27 3:47:28]
# 1

create a JPanel without a layout managerJPanel panel = new JPanel(null) {

public void doLayout() {

:

}

;

and do the layout yourself.

thomas

kloebera at 2007-7-12 8:51:14 > top of Java-index,Desktop,Core GUI APIs...
# 2

Hi,

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/project/showfiles.php?group_id=64833

Source:

http://sourceforge.net/svn/?group_id=64833

http://softsmithy.svn.sourceforge.net/viewvc/softsmithy/trunk/lib/src/org/softsmithy/lib/

API:

http://softsmithy.sourceforge.net/lib/docs/api/index.html

If you have questions just ask me!

-Puce

Pucea at 2007-7-12 8:51:14 > top of Java-index,Desktop,Core GUI APIs...