This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello Friends, I want to draw a pie chart in which I am using fillArc() to draw the PIE chart. but I have to use Frame or Panel for it, I can't Use Applets because the values using which I will draw the arc are in DataBase and Applets can't access databases. So what to do if I want to draw an arc on Frame or Panel...
You mention Frame and Panel which are AWT components so I assume you want to work in the AWT vis–a–vis Swing. Some suggestions: 1 — create a class that extends either Canvas or Panel and override its paint method to do your drawing
2 — import the java.awt.geom package which gives access to the Arc2D class. You will need the Graphics2D context (g2) to draw/fill your arcs.
3 — consider basing all drawing calculations relative to the center of the drawing surface. Math.atan2(y1 - y2, x1 - x2) is a convenient way to get the angle of rotation for any pie slice.