permaculture playing cards*
The moose likes Swing / AWT / SWT and the fly likes Using mouseClicked in swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
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: 19697
    
  20

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: http://aspose.com/file-tools
 
subject: Using mouseClicked in swing