Java: pass an event to another component

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-04-06T20:46:06Z Indexed on 2010/04/06 21:03 UTC
Read the original article Hit count: 200

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about java

Related posts about jpanel