Not that I'm a great Java programmer but I did a little thing like you're describing. In my case, I wanted to graph some X,Y data from a comma-separated-values text file (where each line in the file is x,y). I graph the values with "x"s and compute a linear least squares and plot that line (as a line). Alternatively, I suppose you could plot the lines between the "x"s as lines.
The whole code is a little long (275 lines) and of no interest to anyone on this forum but I'd be happy to send it to you. I only use AWT classes as I use this app. on a PDA, so it's pretty basic. The salient features, after computing the scales (so it fits on the canvas) are:
a canvas
c1 = new Canvas();
a graphics class
private static Graphics g1;
g1 = c1.getGraphics();
and draw a string or draw a line
g1.drawString("x",(int)x2,chgt-6-(int)y2);
g1.drawLine((int)x1,chgt-6-(int)y1,(int)x2,chgt-6-(int)y2);
_________________
Bob Rashkin