How do you get a string from inside an actionListener?
<p>I'm having trouble getting the value of a string i have specified inside an action Listener.</p>

<p>I am trying to access UserMessage from this action listener:</p>

<pre><code>public class UpdateButtonListener implements ActionListener
{

    public void actionPerformed(ActionEvent e)
    {    
        String UserMessage;
        UserMessage = MessageTextArea.getText();
        System.out.println("This is your message: " + UserMessage);
    }
}
</code></pre>

<p>Then access it from this actionListener:</p>

<pre><code>private class EncodeButtonListener implements ActionListener
{
    public void actionPerformed(ActionEvent e)
    {   
        //print Message
        System.out.println("Your Message: " + UserMessage);
    }
}
</code></pre>

<p>They are in different classes in the same package.
I can add the full code if needed.</p>

<p>Thanks</p>

<p>Extra info:
What I want to happen is when I have clicked either the Encode or Decode button.
The action listener running off these buttons to access the action listener on the update button.
The reason that I have the update button is to get the text the user has entered.</p>
