I am writing a application.and i need to draw line in jpanel.but it is crash when jpanel add to jframe.this is my code:

public class Simplification extends JFrame
    JPanel panel;
    public Simplification(List<List<Integer>> transmitionTable , List<List<Integer>> outTable)
        this.setTitle("Simplification Result");
        this.setSize(500, 300);
        this.setLocation(50, 50);

        // do other jobs 
        panel = new JPanel()
            protected void paintComponent(Graphics g)
                g.drawLine(0, 0, 11, 11);               

Interesting bug...
in paintComponent you call super.paint, which in turn calls the paint mathods for the various parts of the JFrame, including a call to paintComponent. That's a recursive loop. You should be calling super.paintComponent

This question has already been answered. Start a new discussion instead.