This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How do you get the JButton name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How do you get the JButton name" Watch "How do you get the JButton name" New topic
Author

How do you get the JButton name

bobby, morkos
Ranch Hand

Joined: Jan 04, 2002
Posts: 82
I have many buttons that have the name "btnName", however the name displayed within the button could be "save", "close", "add", "update", ...
I have somthing like this:
JButton btnName = new JButton();
btnName.setText("save");
When a click btnName, I want to get button name
If button name is "save" the preform action.
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
Hi,
I'm not sure if this is what you're looking for but I think you want to perform different actions depending on the button clisked.
If so , try this:

Hope that was what you were looking for...
Bye,
[ January 28, 2002: Message edited by: Terence Doyle ]

Raising Flares debut album 'Ignition' out now

http://www.raisingflares.com

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do you get the JButton name
 
Similar Threads
how to do validation using java swing?
How to place image on JButton
JTextField Question
Could you make dynmically textfields, labels, and buttons
Name in the Button lines up....