>>1
I don't know if I understand the question correctly but you want to create a clickable tic-tac-toe board in Swing?
Obviously the best practices / most scalable way is to use a GridBagLayout backed by a 2D-Array, each grid/aray square containing an instance of some "Square" class which extends JPanel. In this way you wouldn't really need to specifically instantiate buttons yourself but they would be created inside the Square class as you add squares to your GBL.
If you don't want to do it this way you could just use a custom Graphics and calculate clicked squares based on x,y co-ordinates and use manual line, circle drawing.
The best option however, would be to just write the application using HTML/AJAX and have a horizontally scalable turn-key tic-tac-toe implementation in the cloud.