// VENTANA SENCILLA A PARTIR DE UN JFRAME

import java.awt.*;
import javax.swing.*;

// CLASE PRINCIPAL DEL PROGRAMA (hereda de JFrame)
public class Ventana_sencilla extends JFrame {

  // variables a nivel de clase
  private JPanel panel1;

  // MÉTODO DE ENTRADA AL PROGRAMA
  public static void main(String args[]) {
   // instancia de la clase principal
   new Ventana_sencilla();
   }  

// MÉTODO CONSTRUCTOR QUE CREA Y MUESTRA LA INTERFAZ
// Ventana_sencilla hereda las características de JFrame
 public Ventana_sencilla() {

   /* la variable especial this se usa en métodos de instancia
   * para hacer referencia al objeto que contiene al método,
   * aquí equivale a JFrame */

   // acción por defecto al cerrar la ventana: salir del programa
   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

   // la ventana
   this.setTitle("Ventana desde JFrame");
   this.setSize(340, 240);
   this.setLocation(200,200);
   this.setResizable(false);
   this.setVisible(true);

   }

}