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)
author and iconoclast
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.