#Swing help

8 messages · Page 1 of 1 (latest)

pseudo yoke
#

I would like to learn how to create an ArrayList of JButtons in Swing for the UI of my Tic-Tac-Toe game

hexed shuttleBOT
#

Hey, @pseudo yoke!
Please remember to /close this post once your question has been answered!

light kiln
#

make a list add buttons

frozen grail
#

Sounds rude, but yes. Make an array list with Jbutton as the type. That is probably not what you wanted though

#

I would approach this task with onClick listeners and panels for each square. Once the panel is clicked you could put the x or O their in a variety of ways

#

You could make the panel opaque and show an underlying x or o, you could render the image on click of the x or o . You could get really fancy and have an animation of the x being drawn. I like the JPannel approach because it allows for a great deal of abstraction

#

You could do it with buttons, but your going to have to override the JButton class and really make your own button from scratch. That sounds like a real pain