Results 1 to 3 of 3
  1. #1
    rajkobie is offline Member
    Join Date
    Nov 2010
    Rep Power

    Default How do i remove images from a Jpanel?

    I am currently drawing images on a jpanel using paintComponent method and drawImage ( ) method. But i need to remove the images from the jpanel after a while. How can i remove the images?

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power


    Use an if statement in your paintComponent() method. Only paint the image when whatever condition is true. Set that condition to false when you want to stop drawing the image.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power

Similar Threads

  1. JPanel add/remove in a JFrame
    By Aldane in forum AWT / Swing
    Replies: 2
    Last Post: 03-28-2011, 08:28 PM
  2. Replies: 0
    Last Post: 12-16-2010, 06:14 PM
  3. Replies: 1
    Last Post: 12-04-2010, 04:07 PM
  4. need help with JPanel Images
    By Thebigchalupa in forum New To Java
    Replies: 5
    Last Post: 04-23-2009, 08:15 PM
  5. how to remove all component in container(Jpanel)
    By SaYuNaRa in forum New To Java
    Replies: 3
    Last Post: 04-17-2008, 05:22 AM

Posting Permissions

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