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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With