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 649129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:54:33+00:00 2026-05-13T21:54:33+00:00

I have a Java project that I’m trying to implement with a model-view-controller design.

  • 0

I have a Java project that I’m trying to implement with a model-view-controller design. I have the backbone of all of the components established. I’m having some trouble deciding on how to connect it all together, particularly the view and the controller.

I have a class called MainView that extends JFrame. I have various other classes that help make up the MainView each of which extends JPanel. As an example one of these classes is called ParameterView. Should I allow the controller to see each of these “sub-views” or should I let the controller only see MainView and have everything be managed through there?

Likewise with the model, should the model be managed through one overarching class?

Thanks!

  • 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-13T21:54:34+00:00Added an answer on May 13, 2026 at 9:54 pm

    In the context of GUI (Swing-like) application, the Model-View-Controller is more of a vague suggestion than a concrete design. The number of variants of this “pattern” is staggering and there is no one “proper” variant you should aim at. You can choose either variant that seems to support your current need (and feel free to change it as your app evolves).

    That said, here are some pointers regarding the situation you’re describing

    • You can use a Publish/Subscribe mechanism (AKA: The observer pattern) or the Chain-of-responsibility patten to decouple model (or parts thereof) from the different parts of the view.
    • A facade class (MainView) that packages all parts of the view seems to be a recipe for a “god class”: A class that needs to be changed with almost any change in the app (anti pattern). By exposing the differnt parts of the views you will be able to reuse them in new contexts more easily.
    • Finally, implementing a model by subclassing Swing components does not seem like a good idea. Such a design is very hard to test which means that it is also very rigid. Prefer delegation over inheritance. Or as JBrains puts it: “Stop subclassing, or the kitten gets it”. Use inheritance just for overriding Swing methods. Immediately delegate all logic to objects that are totally isolated from Swing. This will foster testability and future flexibility.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 500k
  • Answers 500k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well - I now managed to solve the problem on… May 16, 2026 at 1:56 pm
  • Editorial Team
    Editorial Team added an answer Added every Dll including those that weren't explicitly needed and… May 16, 2026 at 1:56 pm
  • Editorial Team
    Editorial Team added an answer Sql server : ISDATE (Transact-SQL) ----Invalid date SELECT ISDATE('30/2/2007') RETURNS… May 16, 2026 at 1:56 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a java project that is composed of 3 sub projects that generate
I have a Java project that currently has a lot of JARs in its
I have a Java project that needs a addon interface. I was thinking about
I have a Java project that I've been working on for a while. The
I have a Java project that I build using an Ant script. I am
I have a Java project that expects external modules to be registered with it.
I have a java project that I'm working on which was working until a
I have a Java project that has both server and client packages. In addition
I have a JAVA project that updates a database. But I have to manually
Is it possible to export my maven Java project on Eclipse to users that

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.