Musings about Java and Swing

Tag Archives: Drawing

Kakurasu Using Java Swing

In mid-January, I read a Stack Overflow question about the game Kakurasu.

Moving Eyes

This is a short example of a Java Swing GUI with drawing and simple animation. The eyeballs in the GUI follow the mouse cursor as you move the cursor in the drawing area of the GUI.

Centering a String in a Bounding Rectangle

When I have to draw text, I usually need to center the text in a bounding rectangle. I’ve copied and pasted this Java code several times, and I finally decided to post it here so I can copy the code from here when I need it.