Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to do rubber banding?  RSS feed

 
Siegfried Heintze
Ranch Hand
Posts: 417
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to enhance a sample I found at http://java.sun.com/docs/books/tutorial/2d/display/user.html.

I want to be able to depress the mouse, drag it down and to the right and as I drag, draw on top of the previous rectagle to erase it (using a NXOR operation), draw the new rectangle (normal) and then when the mouse is released, add it to my ArrayList of rectangles.

(1) How do I create a graphics object to draw with? The constructor for Graphics2d constructor is protected.

(2) How do I implement the NXOR drawing mode?

Perhaps someone has an example? I've already done a google search for rubber-banding but was unable to find an example.
Thanks,
Siegfried
 
Siegfried Heintze
Ranch Hand
Posts: 417
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I found the example I am looking for in Ivar Horton's book. Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!