views:

761

answers:

5

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(http://libsdl.org/) library.

+4  A: 

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.

Chris Jester-Young
+1  A: 

A Java binding to SDL can be found here:

http://sdljava.sourceforge.net/

Buggieboy
A: 

The best api i've seen is slick http://slick.cokeandcode.com/

i30817
+2  A: 

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

i30817
A: 

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