This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
hi, can anyone post an example on how to draw n number of circles on a JPanel present within a JFrame, whose center coordinates are stored in an x[] and y[] arrays, where x[] holds the x coordinates and y[] holds y coordinates of the circles, using paintComponent().
I want something like:
A class, say classA, which will have a method, say init() that will add the Jpanel to the Jframe, after instantiating another class, say classB. classB will extend the JPanel. classB will have a method that will generate the values of x and y coordinates and store them in x[] and y[] respectively as well as a paintComponent() which will use these arrays to draw the circles onto a JPanel.
I tried declaring x[] and y[] as class variables but the arrays are still not accessible within the paintComponent().
Please help!
I have been on this since three days!
i have already put 2posts on this but no replies. :|
Rose Jac wrote:hi, can anyone post an example on how to draw n number of circles on a JPanel present within a JFrame, whose center coordinates are stored in an x[] and y[] arrays, where x[] holds the x coordinates and y[] holds y coordinates of the circles, using paintComponent().
I want something like:
A class, say classA, which will have a method, say init() that will add the Jpanel to the Jframe, after instantiating another class, say classB. classB will extend the JPanel. classB will have a method that will generate the values of x and y coordinates and store them in x[] and y[] respectively as well as a paintComponent() which will use these arrays to draw the circles onto a JPanel.
I tried declaring x[] and y[] as class variables but the arrays are still not accessible within the paintComponent().
Please help!
I have been on this since three days!
i have already put 2posts on this but no replies. :|
Thanks!
I will try to help you if you provide me some code of yours......