This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Graphs in swing" Watch "Graphs in swing" New topic

Graphs in swing

Balan Allen

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

Joined: Jul 08, 2003
Posts: 24166

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: 15286

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

GenRocket - A Test Data Generation Platform
I agree. Here's the link:
subject: Graphs in swing
Similar Threads
Which monitor an application is running on
NX: Notes on a design that passed 389/400
keyboard equivalent for buttons
multicolumn TreeViewer with composite as content
bouncing ball