This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.

Well i cant give you the code but maybe u can use this suggestion.

Java considers the upper left hand corner as 0,0 whereas your graph could have the 0,0 at java's 50,50 or any other such co-ordinate.

What you can do is first of all treat X axis and Y axis individually. To get a point in java consider this simple example

Suppose you have an applet of size 100 x 100. So arbitarily i decide to take 50,50 as the origin of the graph.

Now, draw a horizontal line from 0,50 to 100,50 (of Java) as X Axis and a vertical line from 50,0 to 50,100 as Y axis.

Now if the first point in XY Co-ordinates is 10,20 Then establish the point as (50+10),(50-20) on the canvas's co-ordinates. Similarly, point 30,0) will be 80,50 on the canvases Coordinates.