• Post Reply Bookmark Topic Watch Topic
  • New Topic

Abstract Image of JPanel and subcomponents

 
Chaz Branham
Ranch Hand
Posts: 53
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone point me to either a universal class already designed or some training on developing Abstract Images of JPanels and it's subcomponents for use with either dnd or mousemove events? I'm a little stuck and just don't understand it at all.

Thanks,

TheChazm
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read this thrice and still can't make any sense out of it. Perhaps you can rephrase?
If you are asking how to achieve custom painting then check out http://docs.oracle.com/javase/tutorial/uiswing/painting/
 
Chaz Branham
Ranch Hand
Posts: 53
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I start the dragging process I would like to make a copy of the component and it's subcomponents and create sortof a grayed out image of it while dragging. Not added to any layout and just free to be dragged between JPanels. Hense the reason I was talking about abstract images and what not. If this is not the correct terminology then I apologies for the confusion. Does this make more sense?
 
Chaz Branham
Ranch Hand
Posts: 53
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did that make sense?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can possibly explore this
1) Use BufferedImage to generate a "snapshot" of your component
2) Use this image with Toolkit#createCustomCursor(Image image, Point hotSpot, String name)
3) Essentially now you have your image as the cursor. When you move the cursor, the image moves with it. This should provide a proper drag feel to the user
4) On mouse release, revert back to the original cursor and swap child components as required.

Disclaimer: I have never done this myself. Others might have a more elegant solution
 
Chaz Branham
Ranch Hand
Posts: 53
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great! Thank you for the summary of the operations and pointers on where to go This is more than enough to get me going.

Thanks again!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!