Java Swing and JFreeChart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
newbie
Posts: 6
Joined: Tue Feb 13, 2007 9:07 am

Java Swing and JFreeChart

Post by newbie » Tue Feb 13, 2007 9:14 am

Hi,
I new to JFreeChart and have been trying to use it to draw some real time graphs for my application.
However, I have run into some performance issues:
I have a Java swing Frame that has some comboboxes and buttons on it. After I have changed the selections in the comboboxes, I press "Show" button on my InternalFrame to pop up a new InternalFrame that draws my Graph. My problem is that after I open the graph page, all the controls on my previous Frame do no get refreshed properly. e.g, setext on the button doesn't work, Combobox selection don't change etc. I have tried calling repaint(), validate() on my Frame but no effect.
as soon as I close my graph, everything works as per normal.
Please help.

Sir Henry
Posts: 7
Joined: Mon Jun 26, 2006 3:29 pm

Post by Sir Henry » Tue Feb 13, 2007 3:28 pm

I guess you are drawing the graph in a loop, perhaps only to test it. This may prevent the event dispatching thread from updating the rest of your UI.

In real life you will have an external event that causes the graph to update. The time period between the events should give enough time for an UI update.

For now you could try to use SwingUtilities.invokeLater() from another thread to update your graph periodically. Sleep for a second or so before repeating the call.
Cheers, Sir Henry

newbie
Posts: 6
Joined: Tue Feb 13, 2007 9:07 am

Post by newbie » Wed Feb 14, 2007 7:24 am

Thanks Sir Henry for ur reply.
Actually I update my graph data from a thread that I force to sleep for 1 sec for each update.
I will try the SwingJob approach and see how it works...

newbie
Posts: 6
Joined: Tue Feb 13, 2007 9:07 am

Post by newbie » Wed Feb 14, 2007 9:27 am

SwingJob.invokeLater doesn't work either. :(

Locked