first of all, thanks for the suggestions lately where im asking to avoid flicking of the ball.. now its working smoothly :)) but i want now to add some more balls.. like 2 - 3 balls.. how can i do that ? i dont have an idea.. thanks guys..
autorunman22
0
Light Poster
Recommended Answers
Jump to PostStandard approach (very short version):
Ball class implements a single Ball, including its position, velocity etc, and has a public method to draw the ball on a Graphics that is passed as a parameter.
Main class has a window where things are displayed. Creates new Balls on request, and adds …
Jump to PostHere are some pieces of code that illustrate how to put this all together. Don't take them literally - just understand what they are doing and create your own version.
public class Ball { int x, y, xVelocity, yVelocity; Color ballColor; // etc etc ... public paintMe(Graphics …
Jump to PostAn ArrayList<Ball> is like an array of Balls except that it grows and shrinks to fit the number of Balls in it at any time. Experienced Java programmers will use ArrayList (or one of the other similar classes) rather than arrays because you don't have to worry about getting the …
All 10 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
autorunman22
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
autorunman22
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
autorunman22
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
autorunman22
0
Light Poster
autorunman22
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.