// From A Beginning Programmer's Guide to Java
// at http://beginwithjava.blogspot.com/

// Used in the article 'A Most Basic Graphics Application'
// at http://beginwithjava.blogspot.com/2008/07/most-basic-graphics-app.html
// Referenced in the article 'Drawing Lines'
// at http://beginwithjava.blogspot.com/2008/07/in-most-basic-graphics-app-we-had.html

// This program demonstrates a program to do graphics that is as simple
// as possible in Java. It throws aside good coding practices for the sake
// of just being _simple_. If you just want a simple plotting program,
// this may do it for you.
// Or, better yet, it'll help you understand how to do graphics in Java
// so you can go on to write your own programs with better code.
// For more information see the original article, and the other Java
// graphics and GUI articles at the blog.
// by Mark Graybill, July 2008

// Import the basic graphics classes.
import java.awt.*;
import javax.swing.*;

public class BasicPanel extends JPanel{

    // Create a constructor method
    public BasicPanel(){
        super();
    }

     public void paintComponent(Graphics g){
        // This does the actual drawing. Replace with your own drawing code!
        g.drawLine(10,10,150,150); // Draw a line from (10,10) to (150,150)
    }

    public static void main(String arg[]){
        JFrame frame = new JFrame("BasicPanel");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(200,200);

        BasicPanel panel = new BasicPanel();
        frame.setContentPane(panel);          
        frame.setVisible(true);                   
    }
}