Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Graphs in swing

 
Balan Allen
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JFreeChart is a really good Library you can use for drawing Charts.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic