File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Graphs in swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Graphs in swing" Watch "Graphs in swing" New topic
Author

Graphs in swing

Balan Allen
Greenhorn

Joined: Sep 14, 2003
Posts: 2
How can I draw a simple 2D graph using swing in a java application (without using an Applet)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

Hi Balan,
Welcome to Java Ranch!
Yes, you sure can. If it's simple, you might want to do it yourself, from scratch, just using the 2D API calls (methods like drawLine() in the java.awt.Graphics2D class.) There are lots of interesting examples in the JDK; see the demos/jfc/Java2D subdirectory of your JDK directory.
If you want to make more complex graphs, then do a Google search on "Java graph library" -- you'll find plenty.


[Jess in Action][AskingGoodQuestions]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

JFreeChart is a really good Library you can use for drawing Charts.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Graphs in swing