Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/03/2010, 19:24
Avatar de webness
webness
 
Fecha de Ingreso: enero-2009
Ubicación: BOGOTA
Mensajes: 312
Antigüedad: 15 años, 4 meses
Puntos: 5
Información PROBLEMA CON getContentPane()

hola a todos, llevo cierto tiempo sin programar componentes graficos de java con swing y ahora me dio por retomar y no se como mostrar un boton en una ventana. he buscado en internet y todos los codigos de parecen al mio, aqiu mando mi codigo
Código JAVA:
Ver original
  1. package amanda;
  2.  
  3. import java.awt.Container;
  4. import java.awt.event.MouseEvent;
  5. import java.awt.event.MouseListener;
  6. import javax.swing.JButton;
  7. import javax.swing.JFrame;
  8.  
  9. /**
  10.  *
  11.  * @author Administrador
  12.  */
  13. public class Form extends JFrame
  14. {
  15.     public JButton boton;
  16.  
  17.     public Form()
  18.     {
  19.         this.setTitle("champion");
  20.         this.setSize(800,600);
  21.         this.setResizable(false);
  22.         Container container = this.getContentPane();
  23.         container.setLayout(null);
  24.        
  25.         this.boton = new JButton("Evento");
  26.        
  27.         container.add(this.boton);
  28.         this.setVisible(true);
  29.        
  30.         this.boton.addMouseListener(new MouseListener()
  31.         {
  32.             public void mouseClicked(MouseEvent e)
  33.             {
  34.             }
  35.  
  36.             public void mousePressed(MouseEvent e) {
  37.                 throw new UnsupportedOperationException("Not supported yet.");
  38.             }
  39.  
  40.             public void mouseReleased(MouseEvent e) {
  41.                 throw new UnsupportedOperationException("Not supported yet.");
  42.             }
  43.  
  44.             public void mouseEntered(MouseEvent e)
  45.             {
  46.                 System.out.println("ENTRO");
  47.             }
  48.  
  49.             public void mouseExited(MouseEvent e) {
  50.                 System.out.println("SALIO");
  51.             }
  52.         });
  53.     }
  54. }

el cual me muestra la ventana con sus atributos que estableci pero no me muestra un boton que le añadi