Modifying independent JPanels from the JFrame
问题 I've got a JFrame with two separate JPanels. One of the JPanels is filled with JButtons while the other has a couple of text fields. I added mouse listeners to the buttons via the JFrame and I want to make it so that when an event is fired from the first JPanel, the text fields in the second JPanel are changed. The two panels have their own classes. How would I go about doing this? 回答1: Use MVC, Model-View-Control, separation of concerns. Have the Control, which holds your listeners, change