Im really new to swing lib, like maybe 5 days ago I started using it... so I have so many problems... first, I made a Tic Tac Toe game on a JFrame, it would be cool to leave it like that, but then I came with the idea to make a small menu to acces multiple little games (just for fun/practice so far). So I actually succed, then it happens... I made all my games in JFrames so, to make a menu its also another JFrame, so I have so many windows... all the time!
I made some research and people usually makes Jpanels for this kind of stuff.. But I dont know how to transfer my games (Tic Tac Toe) to a JPanel and make it work exactly as it was... here is my code of the Tic Tac Toe in JFrame... the IDE is netbeans.
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.*;
public class Gato extends javax.swing.JFrame implements ActionListener {
Boton MAPA[][];
public static boolean turno=true;
public Gato(){
initComponents();
MAPA= new Boton[3][3];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
MAPA [i][j]=new Boton();
MAPA[i][j].u.setBounds((i*230)+10,(j*230)+10,230,230);
MAPA[i][j].u.addActionListener(this);
this.add(MAPA[i][j].u);
}
}
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel o=new JLabel("Hola");
o.setBounds(60, 60, 100, 100);
this.add(o);
}