In the listener for a button in the actionPerformed(ActionEvent e) part, if you call e.getSource it returns a type object. So how can I turn that object that it returns into the original button?
mastr924
0
Newbie Poster
Recommended Answers
Jump to Postcast it
(JButton) e.getSource()
Jump to PostIf you want to know whether it's button1, button2 etc, you can simply say
if (e,getSource() == button1) ...
All 5 Replies
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Leeibra
-3
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.