I am trying to show a JLabel in a JPanel, but it is not shown to me. I do not know why it will be
My code is as follows:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class DialogoCancion extends JFrame {
private JPanel panel;
private JLabel titulo;
private JLabel interprete;
private JLabel duracion;
private JButton añadir;
private JButton cancelar;
public DialogoCancion(){
super("Añadir Cancion");
setBounds(150, 80, 250, 150);
panel = new JPanel();
panel.setLayout(null);
titulo = new JLabel("Titulo");
interprete = new JLabel ("Interprete");
duracion = new JLabel ("Duracion");
añadir = new JButton ("Añadir");
cancelar = new JButton ("Cancelar");
titulo.setBounds(10, 10, 80, 80);
panel.add(titulo);
panel.add(interprete);
panel.add(duracion);
panel.add(añadir);
panel.add(cancelar);
setVisible(true);
}
}
I want to see titulo
, but nothing comes out.