Two Laptop Bag
The moose likes Swing / AWT / SWT and the fly likes ActionCommand with JLabel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "ActionCommand with JLabel" Watch "ActionCommand with JLabel" New topic

ActionCommand with JLabel

P Jain
Ranch Hand

Joined: Jul 31, 2004
Posts: 52
imageLabel is some JLabel......

is this command is correct.

Regards<br />P Jain
Joe Ess

Joined: Oct 29, 2001
Posts: 9189

Do you see that command in the documentation?

[How To Ask Questions On JavaRanch]
Eddie Vanda
Ranch Hand

Joined: Mar 18, 2003
Posts: 281
Hi P Jain

"setActionCommand" is a method in AbstractButton, so maybe you were meant to use a Button or JButton class. The method associates a String object with the button that you can later retrieve with a "getActionCommand" method. Very handy when some buttons have identical texts on them.

You can put an image on a JButton.

[ August 31, 2004: Message edited by: Eddie Vanda ]

The nice thing about Standards is that there are so many to choose from!
Pat Hays
Ranch Hand

Joined: Aug 20, 2004
Posts: 138
Using mouseClicked()

Download Java GUI Builder, <a href="" target="_blank" rel="nofollow"></a>
P Jain
Ranch Hand

Joined: Jul 31, 2004
Posts: 52
Hi! Friends
Thanks, its working.
I agree. Here's the link:
subject: ActionCommand with JLabel
It's not a secret anymore!