aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Painting graph and charts with Java. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Painting graph and charts with Java." Watch "Painting graph and charts with Java." New topic
Author

Painting graph and charts with Java.

Olena Golub
Ranch Hand

Joined: Jan 17, 2005
Posts: 113
Hello Everyone,


I read a lot of information that the Swing and AWT components should not be used together. I need to implement in my Java application that is based on SWING the possibility to draw graph and charts. I found that the Java 2D can be used for this. But it�s based on JDK 1.3 and based on the AWT components. And my application work with 1.4.
And my question is, are there are some Java libraries (from SUN), that I can use for drawing 2D graph and charts? Or can I use Java 2D with my Swing components together?

Thanks a lot for your help!
Regards,
Olena.


SCJP 1.4<br />SCJD 1.4 (in progress)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

You can certainly combine Swing and AWT components in the same application, but you need to know what you're doing. The main issue is that a Swing component can't be "in front of" most AWT components; so, for example lightweight Swing menus and pop-ups won't be drawn properly on top of a Panel full of Buttons and Choice objects (as opposed to a JPanel filled with JButtons and JComboBoxes, the Swing eqivalent.)

Swing itself is drawn with Java2D. If you have a Java2D-based graph library, it's quite likely that it can be used to draw on a JPanel with little or no modification, anyway.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Painting graph and charts with Java.