File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT / JFace and the fly likes How to get eventSource ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT / JFace
Reply Bookmark "How to get eventSource ?? " Watch "How to get eventSource ?? " New topic
Author

How to get eventSource ??

Pratik Khetia
Ranch Hand

Joined: Jun 29, 2001
Posts: 50
Hi..I am attaching buttons from the JButton array and I need to know the value of the button.
so if jArray[0] = new JButton("User1")
then when I right click on this I want the value "User1"
When I simply click on this I can get it by -
e.getActionCommand()
But in the MouseEvent it doesnt work..
So please let me know if there is any method for that or not..
thanks
Pratik
Jianfei Yang
Greenhorn

Joined: Aug 23, 2001
Posts: 4
You can call getSource() of MouseEvent and get the text of JButton from source object which trigger this event.
Pratik Khetia
Ranch Hand

Joined: Jun 29, 2001
Posts: 50
Hey - I did that using string manipulation but is there any direct method to get the text of the JButton ??

Thanks
Pratik Khetia
 
 
subject: How to get eventSource ??
 
Threads others viewed
Doubt in an Object instance while using evict() method
Deleting duplicate rows using sql query
dynamic selectOneRadio
To have only one JFrame at a time
JButton - Click & Drag prevents Event
IntelliJ Java IDE