There are pre-written solutions that already do what you need. Here are a few of them, though only the first one will work right out of the box for you. The others are addons for particular libraries and use those libraries to perform drawing.
Feng GUI - I can't seem to find the thread for this, but if you search for this around here, you'll surely find it. It's the farthest along of the 3 mentioned here.
SUI - UI library for Slick. This one's well-written and maintained, but it's an addon for Slick, so if you use it, you'll need to bind it to whatever drawing routines you use.http://slick.javaunlimited.net/viewtopic.php?t=187
GTGE GUI. Same deal as SUI. It's well-implemented (though not finished), but it's tied in to GTGE. However, GTGE just uses Graphics2D, so you may be able to use it with little modification. Watch the license though on this one.http://www.goldenstudios.or.id/products/utilities/gui/index.php