Change the position of a button inside a frame on event

wpksortzfe

New Member
Basically, I'm trying to move a \[code\]JButton\[/code\] (or even a \[code\]JLabel\[/code\]) inside a frame using the arrow keys.I've successfully figured out the part to detect the arrow key presses. Now all i want to do is to change the position of the button (or label) depending on the key pressed.E.G. when I press the "UP" key, the button/label should move up by say 5 pixels. I couldn't find the property to change the position of the button.Do I need to put button/label inside the panel or something like that?Please help, its not a homework, just curious :)
 
Back
Top