Results 1 to 2 of 2
  1. #1
    vinaykumar is offline Member
    Join Date
    Oct 2013
    Posts
    4
    Rep Power
    0

    Default How can I paint an oval or a rectangle on a panel with a certain amount of time lag?

    I have made a program that lets you draw a graph on a panel, using MouseListener methods. And now i have to simulate a Breadth First Search Search on that graph. By changing the color of the nodes as i traverse the graph. One node at a time. Suppose i have 3 nodes say 1,2,3. and My BFS says that I have to traverse from 2,3,1. So i want 2's color to change first then 3's color and then 1's but there has to be a significant time delay between the color changing of the nodes. If i use a normal loop and paint the nodes in my paintcomponent method all the nodes are colored at the same time. :/
    Any ideas, how to do this?
    please help.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,409
    Rep Power
    25

    Default Re: How can I paint an oval or a rectangle on a panel with a certain amount of time l

    Use a timer method that changes the data to be drawn and calls repaint() for the paintComponent() to draw the new stuff.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Paint--- trying to paint an oval
    By noobie_nate in forum Java 2D
    Replies: 2
    Last Post: 06-05-2013, 05:45 PM
  2. Oval does not appear in the panel
    By skiabox in forum AWT / Swing
    Replies: 3
    Last Post: 03-21-2012, 01:24 PM
  3. Replies: 5
    Last Post: 02-22-2012, 02:49 PM
  4. Create a rounded rectangle in a panel
    By radhi in forum Java 2D
    Replies: 5
    Last Post: 10-05-2010, 08:58 AM
  5. Replies: 3
    Last Post: 11-22-2009, 08:08 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
  •