This is a really interesting use case. Swing's drag and drop (DnD)
support is based on Swing JComponents.

Piccolo2D is rooted at a PCanvas (which implements JComponent), so
that is where the DnD support would have to be installed. But you want
a Piccolo *PNode* to be drag-and-droppable.

I don't have a definitive answer for you, but this is an idea... You
will install the DnD TransferHandler on the PCanvas. When you detect
that a node is clicked on, you start the DnD transfer
(PCanvas.getTransferHandler().exportAsDrag(...)--something like that.)
I *think* Swing let's you customize the graphic that is used when your
within a DnD operation (see
TransferHandler.getVisualRepresentation()). So you would need to make
this graphic look like the PNode that is dragging, and I think that
would give a nice DnD effect for PNodes.


On Wed, Dec 21, 2011 at 6:31 AM, Jen1234 <> wrote:
> Hello,
> I'm new here so I hope I do this right.
> I am wanted to add node drag and drop support to the Ontograf plug-in
> for Protege4, so I downloaded the source code and it is using the
> ca.uvic.cs.chisel.cajun.jar. I also downloaded the jar's source code
> and it is using Piccolo libraries. So that's why I'm here.
> Could somebody help me on how can I add drag and drop support to a
> PNode? I want to be able to drag a node to a list (outside the graph)
> and also drag a text from a textfield to the graph and add a node. I
> found an old post 
> but I need more guidelines please.
> Thank you in advance.
> --
> Piccolo2D Developers Group:

Piccolo2D Developers Group:

Reply via email to