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

Delete 2D Line  RSS feed

 
S.Subhash Chandran
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way by which we can "delete" a line painted using 2D?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That depends on how the line was drawn... Usually, graphics are drawn in the components paint() method ( or other methods called from the paint method... ) so the simple explanation is just don't paint the line anymore. Then call repaint().

It doesn't make sense to "delete" a line... since graphics are continually being redrawn, why would you waste the time to tell the graphics context to draw a line and then erase it... the end result is the line is not there... so you shouldn't draw it in the first place...
 
S.Subhash Chandran
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the advice! I got the idea...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!