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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:40:19+00:00 2026-06-12T09:40:19+00:00

I just inherited a swing application from a former co-worker that uses a card

  • 0

I just inherited a swing application from a former co-worker that uses a card layout.

It has about 40 different JPanel cards that are all static and make up the GUI.

Each of these static panels are a different class that has about 50 static variables each of their own and they all inherit from the same super class, which is a subclass of JPanel.

I plan to put as many of those 50 static variables and methods as possible into the parent class for readability.

My concern is that all these static variables and JPanels are sitting in memory when they don’t need to be.

I would like to know if this is the way a screen-by-screen GUI should be created or if there is a more efficient way?

  • 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-12T09:40:21+00:00Added an answer on June 12, 2026 at 9:40 am

    Off hand, it doesn’t sound particularly elegant, but that doesn’t mean it’s a bad design.

    As far as memory usage, 2,000 variables isn’t a lot of memory, unless they are big data structures. I wonder how many of the static variables can be refactored. After all, static int sFoo; in two subclasses is two variables in memory, which might server different purposes. Putting them into the common super class means that there is now only one variable, and the (potentially) multiple purposes may now collide.

    Also, efficiency is in the eye of the beholder. Without knowing the details, it’s hard to say if a bunch of static panels is the most efficient way to initialize the app or not. Another type of efficiency is the use of your time. The issue, it seems to me, is whether it is more efficient to patch as needed to maintain the app or will it be more efficient to spend a lot of time up front refactoring, hoping for less time maintaining the app down the road. Who knows? My general philosophy for things like this is, “if it ain’t broke, don’t fix it”.

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

Sidebar

Related Questions

I just inherited a project that has code similar to the following (rather simple)
I've just inherited some code that uses HibernateEntityQuery and EJBQL restrictions. There's an activity
I've just inherited a java application that needs to be installed as a service
I have just inherited a server application, however it seems that the only copy
I just inherited some code that has this construct: <target name=foo depends=-read.SOME.STRING, bar1, bar2>
I just inherited an existing codebase that has multiple configuration files in it. These
I have just inherited a project that uses SecureSWF. I am trying to utilize
I just inherited an ASP.NET WebForms web application that I was tasked with refactoring.
I've just inherited a project, and been told that an entire folder, includes/ needs
I've just inherited a large project previously coded by about 4-5 people. The documentation

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.