13

I'm not sure what the best api for simple 2d graphics with Java is. I know java.awt.Graphics2D was the standard but has it been replaced? Swing is the new API for Java GUI apps but it seems a bit heavy for what I want. What I really want is something like the C SDL library.

bluish
  • 26,356
  • 27
  • 122
  • 180
bjwbell
  • 553
  • 1
  • 6
  • 18

5 Answers5

17

Java 2D (Graphics2D and friends) is indeed the best choice that I know of. Swing is actually implemented on top of Java 2D, so yes, if you want non-GUI-type graphics, Java 2D is the way to go.

Andrew White
  • 52,720
  • 19
  • 113
  • 137
C. K. Young
  • 219,335
  • 46
  • 382
  • 435
5

If you want to have the least work possible if you're building a game (or even if not) use http://slick.cokeandcode.com/

UPDATE: The link has since changed to http://slick.ninjacave.com/

peak
  • 105,803
  • 17
  • 152
  • 177
i30817
  • 1,356
  • 2
  • 13
  • 26
4

A Java binding to SDL can be found here:

http://sdljava.sourceforge.net/

Buggieboy
  • 4,636
  • 4
  • 55
  • 79
3

Processing.org has some good easy-to-use 2D stuff (and 3D). It has a PApplet class that implements Applet from AWT together with a bunch of useful operations and works well together with Java2D.

If you just want to mess around with 2d graphics it has a "sketchpad IDE" where you don't need to put it in your java IDE if you just want to experiment with it.

Spoike
  • 119,724
  • 44
  • 140
  • 158
0

Piccolo can be a good choice for drawing graphics. It is a 2D graphics toolkit that supports zoomable user interface. Available for both Java and .Net.

bluish
  • 26,356
  • 27
  • 122
  • 180
Muhammad Asaduzzaman
  • 1,201
  • 3
  • 19
  • 33