Need Java Help

Doodoo

Golden Member
Feb 14, 2000
1,423
0
76
Im writing a java app that displays the regression line of various points. I have the screen up and when the user clicks on the screen the x and y coordinate is read. How do I get it to draw the regression line? Thanks
 

Descend492

Senior member
Jul 10, 2000
522
0
0
You're going to have to store the point that is clicked on in a two-row array. Then, use the draw functions in applets to draw the lines between the points. If you want a smooth line (which I"m assuming you do), I don't know if there's a command to draw a best-fit line, but if not, you can always have the program calculate the averages over the series of points using calculus. That would be difficult, though, and there's probably a command for doing in already. Of course, don't take my word for it, I'm just using a little problem-solving skills here - I don't do much gui stuff
 

Doodoo

Golden Member
Feb 14, 2000
1,423
0
76
Professor says i can't store the points...and it can't be an applet. There is a command to draw the best fit line, but its in netbeans and he wants us to program the actual method. Thanks for the help.