Forums Register Login
how to get the instance of class that includes the component which activats action ev
public class myone extends JFrame
mylistener oblistener;
JLabel mylabel;
JButton addbtn;
addbtn=new JButton("add");

the above is a main class,how to get the instance of myone that includes the variable addbtn from below?

public class mylistener extends WindowAdapter implements ActionListener
public void actionPerformed(ActionEvent e)
Object ob= e.getSource();
excellent,very thanks!!!
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
ScroogeXHTML 7.1 - RTF to HTML5 / XHTML converter

This thread has been viewed 580 times.

All times above are in ranch (not your local) time.
The current ranch time is
Feb 18, 2018 19:14:40.