aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Using mouseClicked in swing Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Using mouseClicked in swing" Watch "Using mouseClicked in swing" New topic
Author

Using mouseClicked in swing

jagan raja
Ranch Hand

Joined: Jan 29, 2010
Posts: 54
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?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
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
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

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
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using mouseClicked in swing
 
Similar Threads
what layouts to use
Can I distinguish JButtons?
Key Events firing for non displayed controls
Using swing for board game.
BoxLayout