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

The Archive Base Latest Questions

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

I have a question about GUI design, specifically with Java Swing and creating clean

  • 0

I have a question about GUI design, specifically with Java Swing and creating clean separation between presentation and model.

It’s a bit difficult to describe, but essentially we have lots of reference data in our system (i.e. that would correspond to lookup tables in the DB). We want people to be able to edit them all from one screen.

So, in an ideal world what we’d like is a combo box in the top-left corner with a list of ‘types’ of reference data (so each corresponding to one table in the DB).

Then, when selected, a list of the data is populated below, also a filter (or search box). When one of these items is selected, the panel to the right is activated which will allow the actual data to be edited.

Now, here’s the problem: each type of data we need to edit is different, so it has different fields etc. We could go with a generic solution but I’m not really a fan of them – there are lots of different validation rules for each etc, even for different clients, and it would be a nightmare to manage.

We’re using the Presentation Model pattern to achieve some degree of separation between GUI code and the model but I can’t think of a clean way of doing this which doesn’t somehow blur the line of responsibilities a bit.

What are the ways you have solved problems like this?

[Note: apologies for the long question, hope it’s understandable, I can re-phrase if necessary]

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

    You could use the Factory Pattern to create a UI widget for the element that you are selecting. You could also use it to create a validation rule object depending on the type. This would give you some of the flexibility you desire.

    So you can have something like:

    IWidget widget = UIFactory.createFor(myObject.getType())
    

    That can be invoked on the selection event to create the right widget to edit the selected element.

    The IWidget could have methods such as:

    validateData()
    refreshData()
    setDataElement(IDataElement element)
    

    That would allow you to treat all UI widgets generically, but still have a special UI widget for each element type. I am assuming that the elements that you are selecting from the table all implement some IDataElement interface that contains the getType() method.

    I used this solution tied together with the Eclipse Extension mechanism to plug-in new UI elements into my “base” solution, to have an extensible core and a high level of reuse. You could achieve something similar by injecting types and widgets into your factory, either manually or with Spring.

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

Sidebar

Ask A Question

Stats

  • Questions 219k
  • Answers 219k
  • 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 If you are getting HTTP Error 500 Internal server error… May 12, 2026 at 11:51 pm
  • Editorial Team
    Editorial Team added an answer Cached images can be extracted from Firefox's cache by navigating… May 12, 2026 at 11:51 pm
  • Editorial Team
    Editorial Team added an answer Hi there are a lot of different ways. I would… May 12, 2026 at 11:51 pm

Related Questions

I've got an application here that I wrote many years ago that consists of
A while back I read (before I lost it) a great book called GUI
I have worked on single threaded business logic/back-end programming for most of my career.
I'm a freshman in college going for my computer science degree... I've programmed plenty

Trending Tags

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

Top Members

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.