Changing a property of a swing component in a jframe from a different class
Hi, I'd like to know how to change the text of a JTextArea that's in a JFrame when clicking a JButton that's in the same JFrame, but the button's actionlistener is in a separate class.
I explain:
My main class:
publicclass MyWindowextends JFrame{
//[...]
public JTextArea outPutArea =null;
private JButton clickButton =null;
//...
MyActions ba =new MyActions();
clickButton.addActionListener(ba);
/// etc.
}
// the other class
publicclass MyActionsimplements ActionListener{
// constructor
public MyActions(){
}
publicvoid actionPerformed(ActionEvent e){
//JButton foo = (JButton) e.getSource(); // only gives access to the clicked button's properties
// Change the JTextArea content
// ?
}
Thanks in advance,
Lucas

