I can't run my java program
Hi there,
I have typed a program to show some buttons but whe I run this program it not showing nothing, here is the code:
package botonesetiquetasoyente;
import javax.swing.*;
import java.awt.event.*;
/**
*
* @author MIS_ES
*/
publicclass BotonesEtiquetasOyenteextends JFrame{
private JFrame frame;
private JLabel etiquetas;
private JButton botonUno;
private JButton botonDos;
private JPanel panel;
/**
* Creates a new instance of BotonesEtiquetasOyente
*/
public BotonesEtiquetasOyente(){
etiquetas =new JLabel("No se ha pulsado ningun boton");
botonUno =new JButton("Boton uno");
botonDos =new JButton("Boton dos");
panel =new JPanel();
panel.add(etiquetas);
panel.add(botonUno);
panel.add(botonDos);
OyenteAccion oyenteBoton =new OyenteAccion();
botonUno.addActionListener(oyenteBoton);
botonDos.addActionListener(oyenteBoton);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Ventana con interaccion");
pack();
setVisible(true);
}
/**
* @param args the command line arguments
*/
publicstaticvoid main(String[] args){
BotonesEtiquetasOyente ventana=new BotonesEtiquetasOyente();
}
class OyenteAccionimplements ActionListener{
publicvoid actionPerformed (ActionEvent evento){
JButton boton =(JButton) evento.getSource();
etiquetas.setText("Boton pulsado: " + boton.getText());
}
}
}
Message was edited by:
RIMA33

