How to make a checkerboard of JButtons

graphics, java, jbutton, swing

Solution

Take a look at the GridLayout you can find examples on how to use it here. Lastly, I think that using JPanels will give you a better finish than using JButtons if you want to create a checkered board, but that is entirely up to you.

Problem

I need to make a checkerboard that is composed of alternating black and white JButtons, that are right up against another. Can I use the graphics class to add buttons? I would appreciate help not answer as this is homework.

Original source