Avoid Circular Reference in Swing GUI

Posted by drhorrible on Stack Overflow See other posts from Stack Overflow or by drhorrible
Published on 2010-03-15T18:19:23Z Indexed on 2010/03/15 18:29 UTC
Read the original article Hit count: 172

Filed under:
|
|
|
|

Maybe it's not worth worrying about in this scenario, but lets say you have two classes, a JFrame with all its components, and a server-like class that handles requests from remote clients. The user is able to start and stop server objects through the GUI, and is shown various events that happen to each server object. Whether or not I use an explicit pattern (like MVC), it seems like the JFrame needs a reference to the server class (to call start and stop) and the server needs a reference to the JFrame (to notify of it of certain events).

Is this a problem, or am I looking at this situation in the wrong way?

© Stack Overflow or respective owner

Related posts about java

Related posts about swing