The new class would contain a reference to the Rectangle that contains/surrounds the image as shown on the screen and a reference to the image.
It would have methods that you could call to see if a...
Type: Posts; User: Norm
The new class would contain a reference to the Rectangle that contains/surrounds the image as shown on the screen and a reference to the image.
It would have methods that you could call to see if a...
The image is being drawn at a certain x,y location on the screen. Define a rectangle with its upper left corner at the same location that the image's x,y location. Have a class that associates that...
What you need is a way to determine which image is to be moved when you press the arrow keys.
Then when you have selected which image, only move that image when the arrow keys are pressed.
Then if...
The current code uses the Arrow keys to move the images.
Have you tried changing that code to use the "cursor keys"?
What/where are "cursors keys"? I don't understand what you mean.
The code you posted uses the Arrow keys.
Have you tried changing it to use the "cursors keys"?
For example keyCode of 40 is the KeyEvent.VK_DOWN keyCode.
What are the VK_???? names for the...
Look at this site. It has code that uses the cursor to move labels around.
How to move or drag a Graphics Class Object [Like Select in Paint-Editor] - Java
Not sure what you mean by cursors. I only have one cursor on my system.
To cause movement with the cursor would require you to use mouse listeners.
How would you "set the focus" on an image?...
Do you want to change what controls the image movement to be the mouse click or motion instead of the pressing of a key?
Or do you want to use the same keys but have only one image move?
How will...
Look at how the one image is being moved.
How do you want to make the other image move? What keys or cursor or other controls do you want to use to make it move?
The code you posted does not compile. It has many errors in it.
Please edit your code and wrap it in code tags. Use the Go Advanced button below, select your code and press the #icon button above the input box.
Or see this: BB Code List - Java Programming...