I have a Minesweeper with a JMenu at the top and a GridLayout that is the Minesweeper, but I would like to add a JLabel at the top and I do not know how.
I've tried it but it shows me below I leave code and photo.
public Buscaminas(Controlador c) {
this.controlador = c;
FILES=controlador.tauler.getFiles();
COLUMNES=controlador.tauler.getColumnes();
BOMBES=controlador.tauler.getBombes();
configuracio();
botons = new Boto[FILES][COLUMNES];
configGraella();
this.pack();
this.setVisible(true);
setLayout(null);
barra=new JMenuBar();
setJMenuBar(barra);
menu=new JMenu("Dificultad");
barra.add(menu);
facil=new JMenuItem("Facil");
facil.addActionListener(this);
menu.add(facil);
normal=new JMenuItem("Normal");
normal.addActionListener(this);
menu.add(normal);
dificil=new JMenuItem("Dificil");
dificil.addActionListener(this);
menu.add(dificil);
pers=new JMenuItem("Personalizado");
pers.addActionListener(this);
menu.add(pers);
label= new JLabel("Bombas");
label.setBounds(0, 0, 100, 20);
add(label);
}
In the image what I point out is the JLabel I think ...