Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6625149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:44:21+00:00 2026-05-25T21:44:21+00:00

1.I would like to know if the following structure is incorrect, what is the

  • 0

1.I would like to know if the following structure is incorrect, what is the reason, and what is the solution for that:
Assume I have implemented a client for net game
The client has 2 main packages:
A.GUI – hold all the swing Jpanels etc.
B.LogicEngine

In Logic engine I have a class called clientThread which main goal is to communicate with the server to get commands to execute on the Gui Panel and also to send information back as a result of the user choices on the Gui Panels..

2.In order to do so I tend to hold reference of my main Gui panel in clientThread and vise versa, is it so wrong to do cyclic reference between two classes of different projects?

3.Is it wrong in matter of object oriented programming to execute things to be shown on the Gui from within class like client thread which is responsible in some way to manage the flow of the game although it is on logical engine package?

4.Also if the Gui part know and uses the logical part is it a problem?

Would like to hear some advices
Thank you very much

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:44:21+00:00Added an answer on May 25, 2026 at 9:44 pm

    Obviously the GUI should depend on the engine, not the other way around (and, god forbid, they should not depend on each other).

    Your problem is actually pretty common and simple to solve. The engine thread should allow client code to install a listener that will be notified every time something happens. Than GUI implements that listener and installs it. Note that the game logic engine is only aware of the listener interface, not the particular implementation that lies in your GUUI package.

    This is an implementation of the Observer pattern and it has several advantages:

    • notifying code (logic) is not coupled with the “interested” code (the GUI), there is not dependency from engine to GUI
    • you can plug any implementation of listener/observer, for instance changing Swing application to console/mobile/web application without any change to the engine.
    • you can have several listeners, e.g. one to update the GUI, second one to run sound, etc.

    Finally there is nothing wrong with manipulating your GUI from logic thread, hoever you must be aware of event dispatching thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have links in the following structure and I would like to know what
I would like to have the following structure in my SVN Repository External -
I would like to know following: I added the folder Graphics into my project
I would like to know if the following code are valid. The original intension
I would like to know if the following is possible in any of the
i would like to know whether the following query is optimized? select SUM(payments.paid_amt) as
I would like to know if the following is possible in Scala (but I
I would like to know if the following code would be a good pattern
Being new to OpenCL i would like to know if the following scenario is
I would like to know what will happen in the following hypothetical situation. Let's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.