I would have thought the paintComponent() method of a JPanel is easiest to use.
You find it is passed a Graphics object usually called
g; you don't have to find the Graphics object, the JVM or something passes it for you.
Try the g.drawLine() method using the Graphics object.
There isn't a lot I can find on a quick look at the
Java Tutorial; look for JPanel
here, then sercah for "paintComponent", and Graphics is
here. Beware; there is also a paintComponents() method.
Another warning: the
y coordinates run from top to bottom.