• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Abstract Image of JPanel and subcomponents

 
Ranch Hand
Posts: 53
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did that make sense?
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
When you have exhausted all possibilities, remember this: you haven't - Edison. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic