JavaFX - System Monitor
My previous post on LineChart uses simulated CPU usage data. Just thought of updating that to show live CPU and Memory information.
A tribute to all
users
For Applet mode, click on above image
One of the way to implement this is to use some existing command line utilities. I used - top - command to get the CPU and Memory usage information. Execute top using ProcessBuilder, get the Process instance. Get the output stream from process and read the output of top command. Now parse this content (a bit tricky, each version had its own output format) to get the information.
Note: The implementation is not concrete (as it relies on simple text parsing), may not work on some platforms or locales due to difference in output of top command. It will not work on platforms which does not support top command.
Try it out and let me know feedback






works fine on my system and looks cool too, are you planning to give out the source?
Posted by Vaibhav on June 28, 2009 at 06:05 AM IST #
@Vaibhav Sure! I have uploaded the source. Its mostly java and involves plain text parsing.
Posted by Rakesh Menon on June 29, 2009 at 09:46 AM IST #
The chart looks very nice, is it a standard JavaFX component?
Keep up the good work!
Posted by Gian on June 30, 2009 at 05:51 AM IST #
@Gian Thanks! Yes, its part of JavaFX 1.2 Refer to javafx.scene.chart package. http://java.sun.com/javafx/1.2/docs/api/
Posted by Rakesh Menon on June 30, 2009 at 08:48 AM IST #
Hi , Rakesh this example is really informative..
thanks for posting..
Well i am facing little problem.... i have create one custom list view based on the sample code given by you on http://javafx.com/samples/Tweeter/
but now when i am trying to add more items like around 900 items it is showing me
java.lang.OutOfMemoryError: Java heap space
error at runtime ... so could you just tell me how to resolve it so that my list view can take enough number of records..
Posted by Nihar on October 15, 2009 at 02:27 AM IST #
@Nihar Sorry that approach is not scalable. You may try http://jfxstudio.wordpress.com/2009/06/20/a-custom-virtual-list/ Proper fix will be available in next release.
Posted by Rakesh Menon on October 23, 2009 at 04:29 PM IST #