Results 1 to 2 of 2
  1. #1
    usha is offline Member
    Join Date
    Oct 2010
    Posts
    11
    Rep Power
    0

    Default how to remove images drawn by using Graphics Object

    Hi,

    I am developing one application.I have drawn some shapes on Panel object like line, Triangle etc using Graphics object. now my requirement is to select and delete required shape. i used some mouse events and selected one of the shapes. Now how to remove the selected shape? If i call paintComponents(Graphics g)method all the shapes on panel object are removing. But i want to remove only the selected one. Please help me.

    Thanks in advance,
    Usha.

  2. #2
    mrmatt1111's Avatar
    mrmatt1111 is offline Senior Member
    Join Date
    Aug 2009
    Location
    San Jose, CA, USA
    Posts
    320
    Rep Power
    6

    Default

    Keep track of the objects that should be drawn in a data structure (list, map, set) and repaint them all when there is an update to that group of objects. That allows you to add new ones, remove old ones, move them around, etc...
    My Hobby Project: LegacyClone

Similar Threads

  1. Replies: 3
    Last Post: 10-20-2010, 07:24 AM
  2. How to Remove Duplicate object from collection
    By santhoskumara in forum Advanced Java
    Replies: 4
    Last Post: 08-04-2010, 08:07 PM
  3. do I need to dispose of my Graphics object?
    By gib65 in forum AWT / Swing
    Replies: 3
    Last Post: 07-06-2010, 06:04 AM
  4. how to remove an object from the array list
    By cecily in forum New To Java
    Replies: 3
    Last Post: 08-02-2007, 03:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •