/**
 * Write a description of class EjemploDibujo here.
 * 
 * @author Manuel Fernandez Barcell 
 * @version 0.1
 */

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

public class EjemploDibujo extends JFrame implements ActionListener
{
    // instance variables - replace the example below with your own
    private JButton boton;
    private JPanel panel;

    /**
     * clase main
     */

  public static void main(String[] args)
  {
        // initialise instance variables
        EjemploDibujo marco = new EjemploDibujo();
        marco.setSize(400, 300);
        marco.setVisible(true);
        marco.createGUI();
       
  }

    /**
     * createGUI()
     *    
     */
    private void createGUI()
    {
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      Container ventana = getContentPane();
      ventana.setLayout(new FlowLayout());
      panel = new JPanel();
      panel.setPreferredSize(new Dimension(300, 200));
      panel.setBackground(Color.blue);
      ventana.add(panel);
      boton = new JButton("Haz Clic");
      ventana.add(boton);
   
      boton.addActionListener(this);
    }
    public void actionPerformed(ActionEvent event){
        Graphics papel = panel.getGraphics();
        papel.drawLine(30, 0, 100, 100);
    }
}
