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

  • Home
  • SEARCH
  • 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 9206233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:07:56+00:00 2026-06-18T00:07:56+00:00

I have read about MVC but am having doubts on how to implement the

  • 0

I have read about MVC but am having doubts on how to implement the concept in Java with Swing. Here’s what I’m going for:

The model:
ListOfThings contains a Collection of Thing objects.

The controller:
Controller instanciates ListOfThings and populates it with a “add” method (internally creates a new Thing and adds it to the Collection)

The view:
A Swing interface with a ListOfThingsPanel which will contain ThingPanel components to represent the model. Both extend JPanel. ThingPanel contains various components meant to display the data of the Thing it’s linked to.
It also has a button which adds a new (empty) thing to the list.
The click event calls the Controller‘s addThing() method which asks ListOfThings to add a new Thing to its list. ListOfThings has an event/listener system and ListOfThingsPanel listens to it to know when it should refresh the view.

Am I properly following the MVC concept by doing it like this?

Update:
I’m still learning Java but I have coding experience and would prefer to learn the theory and attempt it by my own means before using premade frameworks. While I’m aware Swing implements the MVC pattern, I have read it does it in a specific way (View and Controller combined) which might not be the best and not applicable in other circumstances. I’m a bit wary until I can make sure “Swing MVC” is not different from “MVC”, or that the differences won’t impact my understanding of the underlying ideas.

One thing of import to me is to learn to really separate the model from the view to allow me to ultimately create various views of various types (Swing but also console or update to JavaFX for example) This is why I’d like to avoid anything Swing specific outside of the view part itself.

  • 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-06-18T00:07:57+00:00Added an answer on June 18, 2026 at 12:07 am

    While the Swing framework already implements a form of MVC (explicit models; JXyz & UI classes = controller & view), this strict separation is rarely used on application level and looks rather weird.

    To start I suggest to follow the following design:

    • implement the client-side business logic with POJOs
    • wrap the POJOs with custom Swing models where needed (ListModel, TableModel)
    • Use a GUI builder to design the GUI
    • Use the Mediator pattern to listen for events (a custom subclass of JPanel listens for events of its children and updates other children or fires own custom events if needed)

    If you want to go a step further, use a RCP such as the NetBeans Platform (very recommended).

    Edit:

    And here is the article explaining MVC in Swing:

    http://www.oracle.com/technetwork/java/architecture-142923.html

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

Sidebar

Related Questions

I have read a lot about MVC design pattern, but some of the things
I have read about continuency parser and dependency parser. but confused which could be
I have read about a lot of people having problems with the browser not
I have read about application object in android site but I couldn't understand. What
I've read tutorials etc on the web about localization in Asp.Net and MVC, but
I am new in PHP and have read about MVC. Currently, I am not
I am read about MVC pattern, that whole php logic must be in model,
I have read many posts on Session-scoped data in MVC, but I am still
I have read a ton of questions/answers on here regarding questions similar or about
I have read a lot about how to validate dynamically generated content in mvc

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.