"The right way:" There are many "ways." Some are better than others. Some ways are technically "wrong" but will work anyway, most of the time. Other ways are just plain wrong because they don't...
Type: Posts; User: GregBrannon
"The right way:" There are many "ways." Some are better than others. Some ways are technically "wrong" but will work anyway, most of the time. Other ways are just plain wrong because they don't...
I'll address your comments near the end later when I have more time, about 3 hours from now. In the meantime, please work through this excellent article/tutorial, Performaing Custom Painting. Work...
What don't you understand about the working code I posted? Or is that fine, but now you're thinking about the next step? If you're thinking about the next step, let's start with code you understand...
Okay. The changes I made are relatively minor but critical to getting it to function as desired. Let me know if you have any questions:
Main:
// imports
import javax.swing.JFrame;
import...
Other thoughts:
I would add the KeyListener to the Panel instance.
You should be overriding the paintComponent() method in Panel and not Paint().
The method names in Keys should begin with...
It's good to have the additional detail of your assessment of the problem and how you got there. Since you're having difficulty moving from single class to multi-, do you have the single-class...
You shouldn't have to delete anything. Start a new program as a learning exercise to practice the basics required to do one or two specific things: draw an object, make it move. Come here with the...
That's a lot of code to practice moving an object around a JPanel. You should write a simple, short example that paints a shape on a JPanel at specific coordinates and then moves around by changing...