Hello everyone,

I am trying to draw lines inside panles or other components but I don't understand how this works.
I mean lets say I have a JPanel dArea= new JPanel(); where I have some pictures and other writing inside, how would I draw lines inside that panel instead of drawing lines on the main frame

I have the code to draw thick line but its now drawing inside components that I want.
Code:
public void thickLine(Graphics g) 
	{
		
		
		 g.drawLine(0,0,100,20);    //default
		 Graphics2D g2 = (Graphics2D) g;
	     g2.setStroke(new BasicStroke(3));
	     g2.drawLine(0,100,20,0);   //thick
	     
		
	}