Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing graphics  RSS feed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone direct me or tell me where to get starting on dragging an image with the mouse in Swing. I have looked at the 2D API and was wondering if there is another method for doing so. The 2D examples all move painted rectangles and not Images such as GIFS or JPEGS.
Any suggestions??
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Gregg........
if u can move painted rectangles with mouse u can move image too. All u need to do is paint the rectangle with image and move that painted rectangle. to do this u need to convert Image to BufferedImage and then use TexturePaint. abd fill the rectangle with TexturePaint.
hope this will help u.
herbert schildt
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Herburt. That does help.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!