File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Swing / AWT / SWT
Using mouseClicked in swing
Joined: Jan 29, 2010
Jan 29, 2010 05:18:33
I want to move JButton one step to the left , right, up and down when i click on the JButton.
Can any one help me in this?
Joined: Jun 09, 2003
Jan 29, 2010 11:27:23
generally the parent would be a null layout, and you just change the location with the click
left/right change x, up/down change y
Joined: Oct 27, 2005
Jan 29, 2010 13:02:54
Check out setLocation. But as Michael said, you need a null layout, or the layout manager will ignore the location you set manually.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
I agree. Here's the link:
subject: Using mouseClicked in swing
what layouts to use
Using swing for board game.
Can I distinguish JButtons?
Key Events firing for non displayed controls
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014