What is the best API for creating simple 2D graphics in Java, and how has the landscape changed over time?

I’ve worked with Java for years—mostly for tooling and quick visual demos—and if you’re starting out with 2D graphics, your first stop should really be the basics.

Honestly, java.awt.Graphics2D is still a strong contender. It’s part of the core JDK, so there’s no external setup, and for simple shapes, lines, or images, it just works.

public void paint(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    g2d.drawLine(10, 10, 100, 100);
}

This native java graphic lib plays nicely with Swing and AWT. Sure, it’s a bit old-school, but for educational tools, lightweight apps, or quick visualizations—it’s solid.

:small_orange_diamond: Best for: Prototypes, quick builds, or if you just want to avoid extra dependencies.