Java: pass an event to another component
- by John
Sorry I don't know if this is very clear, but I'm pretty new to Java.
So I have a JFrame with a BorderLayout containing a JPanel and a JButton.
What I want to do is when something happens in my JPanel, I want for example change the text of the JButton, or enable/disable it. How would I do that? How can I access the JButton from the JPanel? I know some ways of doing it but I don't think they're the best way to do it.
What would be the best way to do this?
Thanks in advance