You define a component like JPanel and override its paintComponent() method. It will be called when the JPanel's repaint() method is called. There will be a list of the Balls to draw that the...
Type: Posts; User: Norm
You define a component like JPanel and override its paintComponent() method. It will be called when the JPanel's repaint() method is called. There will be a list of the Balls to draw that the...
A thread is not a component. You can have many threads used by or using one component. By component I mean a class that extends the Component class, like JPanel or JButton.
Change the logic to have a single component with an override to the paintComponent() method that has a list of balls to draw within its area.
I have no ideas.
Yes that's it. Make these changes to see:
setSize(FRAME_WIDTH, FRAME_HEIGHT);
setLayout(new GridLayout(4,1)); //<<<<<<<<<<<<<<<< ADDED
addBall(10,50);
...
Sorry, having 5 separate files makes it hard to copy for testing.
Can you put all the source into a single file to make it easier to copy and paste into my editor for testing?
I got it.
I get...
Please post the code here on the forum.
For testing this kind of problem you need a program that compiles, executes and shows the problem.
Please make a small program for testing and post it.