Dear folks, I am asked to maintain some existing code and I am new to Awt. This is the problem : I need to create a dynamic Panel where I can drag and drop components from another panel. I need to create a form where the user chooses what components to have. The user can choose whether he/she needs a text box, a check box or a Label. The code already existing (which was written by someone else is) code provides the user with two panels. Left panel is like the drawing board. Right panel, the user has checkbox, Label etc. The user drags and drops each button according to his wish. The first design problem I run with is this: How do go about providing undo or delete an already dropped component? I am sure I will have much more problems...but one by one.. :-) Thanks a lot guys. Tei.
WoW! You do have quite a chore ahead of you! I suggest you start looking into a Java based GUI builder application that has source code available and then tweek/tailor it down to fit your needs. There is an enormous amount of code required to do what you described in a professional manner. Just think of some of the things envolved; layout management, color management, perferrence management, Z-order and focus management, and, and, and etc. Since it sounds like you are only at the Panel level, you'll need to go back to the JDK to check-out MouseListener and MouseMotionListener, Undo, and many, many,...others. Basically, code up some template "components" that get added to the target panel at the location of the mouse when the mouse button is released following a drag from the template's "tag" component that's the source of the drag operation. Good Luck, - Dan
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop