posted 23 years ago
Dinesh,
Yes, of course it is possible to draw a graph in Java... I can't really provide you with code because the question is too general... It depends on how you want to do it... Do you want to draw a bar graph, a pie chart, a line graph, etc.? You can also create a custom component that will display a graph, or just have the graph hard coded into your application. Personally, I would make a component that could be added to any application ( more OO, and easier to reuse! ) and use some type of collection inside to save all the graphs, their values and associated colors inside the component. I would then have the paint() method of the component go through all the graph values and paint them however you wanted. (points, lines between points, filled rectangles, arcs, etc. , depending on the type of graph you want...)
HTH,
-Nate
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.