Hey fellas I need some help writing a program that plots two points on a graph in point intercept form in (x,y). I have recently programmed a times table program. i just don't understand how to graph points.
thanks for your help!
Printable View
Hey fellas I need some help writing a program that plots two points on a graph in point intercept form in (x,y). I have recently programmed a times table program. i just don't understand how to graph points.
thanks for your help!
What you could do is draw points on a JPanel or other JComponent by editing that component's paintComponent() method. In this case, you would simply use the x, y coordinates and that would translate onto the panel (ie, the point (50, 100) would be used to draw a dot 50 px from the top of the panel and 100 from the left). Note that using this method, y grows larger as you move DOWN the panel (so you'd have to invert the y coordinate).
Sorry I can't be more clear... Gotta go to a band concert! ;)
In the paintComponents() method you can use the Graphics class's drawOval method to draw a point.Quote:
how to graph points.
Look at the other methods of the Graphics class to see if there are other's that might help you.