home *** CD-ROM | disk | FTP | other *** search
/ PCMania 5 / Pcmania_Ep2_05_CD-01.iso / ARTICULOS / PROGRAMACION / Tallerdejava / Principal.java < prev    next >
Encoding:
Java Source  |  2000-01-31  |  622 b   |  32 lines

  1. import java.awt.*;
  2. import javax.swing.*;
  3.  
  4. public class Principal extends Frame
  5. {
  6.   private JButton boton;
  7.  
  8.   public Principal()
  9.   {
  10.     super ();
  11.  
  12.     // Crear el boton
  13.     boton = new JButton ("Esto es un boton");
  14.     // Crear el listener
  15.     setLayout ( new BorderLayout() );
  16.     Oyente oyente = new Oyente();
  17.     boton.addActionListener( oyente );
  18.     boton.addMouseMotionListener( oyente );
  19.     reshape(50,50,300,340);
  20.  
  21.     // A±adir boton
  22.     this.add ( boton );
  23.  
  24.     validate ();
  25.     setVisible ( true );
  26.   }
  27.  
  28.   public static void main ( String[] main )
  29.   {
  30.     new Principal ();
  31.   }
  32. }