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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:44:54+00:00 2026-05-10T20:44:54+00:00

I cannot figure out a way to disable a container AND its children in

  • 0

I cannot figure out a way to disable a container AND its children in Swing. Is Swing really missing this basic feature?

If I do setEnabled(false) on a container, its children are still enabled.

My GUI structure is pretty complex, and doing a traversion of all elements below the container is not an option. Neither is a GlassPane on top of the container (the container is not the entire window).

  • 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. 2026-05-10T20:44:55+00:00Added an answer on May 10, 2026 at 8:44 pm

    To add to mmyers’s answer, disabling children is not an easy task (see this thread)

    The problem is near-to unsolvable in the general case. That’s why it is not part of core Swing.

    Technically, the disable-and-store-old-state followed by a enable-and-restore-to-old-state might look attractive. It even might be a nice-to-have in special cases. But there are (at least, probably a bunch more) two issues with that.

    Compound components

    The recursion must stop on a ‘compound component’ (or ‘single entity’). Then the component is responsible for keeping dependent’s state. There’s no general way to detect such a component – examples are JComboBox, JXDatePicker (which as related issue)

    To make things even more complicated, dependents don’t need to be under the hierarchy of the ‘compound component’, f.i. JXTable takes care of the ColumnControl’s (and header’s) enabled state.

    Trying to tackle both would require to have

    a) a property on the compound: ‘don’t touch my children’ and
    b) a property on the uncontained dependents: ‘don’t touch me’

    Binding to enabled

    enable-and-update-to-old might break application state if the enabled status is bound to a (presentation or other) model property and that property changed in-the-meantime – now the old-state is invalid.

    Trying to tackle that would require to have

    c) a ‘real’ stored-old-enabled-due-to-view-concerns property
    d) bind the presentation model property to both the enabled and the stored-old-enabled

    JXRadioGroup has a variant of that problem: On disabling – the group itself or the general controller – keeps track of the old-enabled of every button. Button’s enabled is controlled by the Action – if there is an Action. So the enabled controller needs to restore to old-enabled or to action’s enabled. During group’s disabled (as-group) a problem looms if the Action’s enabled was false on storing and changed to true. Another if actions are added.

    Now imagine the complexity of state transitions when overloading a)– d)

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

Sidebar

Related Questions

I cannot figure out a way to get other channel types, e.g. sender channel,
I cannot figure out this positioning problem in Firefox. It doesn't seem to follow
I cannot figure out why this doesn't work. It seems so simple. It should
I cannot figure out why I get this error during check-in. I checked in
I cannot figure out how to convert this code from C# to VB.net. It
Seems simple enough, but I cannot figure out any way to determine what the
I cannot figure out a way to check if the value of an element
I cannot figure out which way it goes. It seems like casting it into
In the code below, I cannot figure out a way of passing a member
Cannot figure out, where to change EOF in PyCharm. My scripts start with :

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.