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);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
// do other jobs
panel = new JPanel()
{
protected void paintComponent(Graphics g)
{
super.paint(g);
g.drawLine(0, 0, 11, 11);
}
};
panel.setVisible(true);
this.add(panel);
}
}