Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a checkerboard of JButtons

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.

like image 956
Dredge Mage Avatar asked Apr 06 '12 15:04

Dredge Mage


1 Answers

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.

like image 160
npinti Avatar answered Oct 11 '22 18:10

npinti