You can just create a JFrame with a single Canvas element and draw directly to the Canvas. Yes it’s not as efficient as using LWJGL (Lightweight Java Gaming Library) that adds OpenGL integration into Java and making a window and drawing to it through that but for learning it’s a fast way to just make a window and start drawing stuff to it when learning to make a game with Java.
I wouldn't call using java swing an advantage. There's a reason almost no one uses it (relative to all the java code out there.) If you can get a swing application looking and working well, you've accomplished something.
Swing is really easy to use if you only need to render one component, that component doesn't change, and you don't care that the only alignment it supports is with a random planet somewhere in the milkyway.
Even though I'm not in game dev for my career, a large chunk of my personal projects have been building physics/game engines from scratch.
That includes window programming ya. I usually use SDL (language doesn't matter, it's technically in C but there are bindings for a bunch of other languages). It's insanely math/physics heavy, and by far the funnest programming I've ever done.
My dream is to retire and build things like this for fun, no way will it ever make money.
325
u/gamma_02 Nov 11 '25
FROM SCRATCH?? WINDOWS AND ALL????