D'n'D..
> D'n'D..
>
[quoted text clipped - 9 lines]
> that the draggable entities must be components, but what
> about the reference to 'paint'?
I have a version where all my game pieces are just all painted on to their
component.
ie the pieces are NOT components.
> FWIW - you can override paint in your draggable components. (??)
>
> ..I go back to "You've lost me.".
Ah, but the draggable does NOT have to be a component, you only need to pass
a reference of your source container to the TransferHandler...
protected Transferable createTransferable(JComponent sourceContainer)
Then you create a Transferable in anyway you see fit, in the version
described above I am getting some data from sourceContainer (an image and
model object) and wrapping it in a Transferable.
I'm now leaning towards changing it to components for accessibility reasons.
I will have a max of 100 game pieces, so they could all be JPanels, but only
7 are transferable at any one time, so I could paint the others on.
--
Mike W
Andrew Thompson - 22 Oct 2005 11:22 GMT
> I'm now leaning towards changing it to components for accessibility reasons.
Probably best. You'll get those who might complain of the
'extra overhead', but I bet it is not noticeable in the way
the GUI actually behaves (unless you are talking about
*thousands* of transferables!).
VisionSet - 22 Oct 2005 11:32 GMT
> ...but I bet it is not noticeable in the way
> the GUI actually behaves (unless you are talking about
> *thousands* of transferables!).
No, I wrote some scrolling calendar thing once and it was only just
noticable with 6 months of day components on it. And that was back at
JDK1.3. Obviously I don't do stuff like that anymore ;-)