How about, I have the following code but at the time of executing it, only the window is seen and no control is displayed, could you help me?
Operations Class
public class Operaciones {
public static void main(String[] args) {
// TODO Auto-generated method stub
Ventana venta=new Ventana();
venta.setVisible(true);
}
}
Window Class
import java.awt.Container;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class Ventana extends JFrame{
//private static final long serialVersionUID = 1L;
private JLabel lbl1=new JLabel("Numero 1");
private JLabel lbl2=new JLabel ("Numero 2");
private JLabel lblResultado=new JLabel("Resultado");
private JTextField txt1=new JTextField();
private JTextField txt2=new JTextField();
private JButton btnSuma=new JButton("+");
private JButton btnResta=new JButton("-");
private JButton btnMultiplicacion=new JButton("*");
private JButton btnDivision=new JButton("/");
private Container c= getContentPane();
public Ventana(){
super.setTitle("Operaciones");//título de la ventana
super.setSize(320, 480);//tamaño de la ventana
super.setDefaultCloseOperation(EXIT_ON_CLOSE);//libera la memoria
cargarControles();
}
private void cargarControles() {
c.setLayout(null);
lbl1.setBounds(10,10,300,20);
txt1.setBounds(10,40,300,40);
lbl2.setBounds(20, 20, 300, 20);
}
}