Disabling events for a container and its children

I've stumbled across this one and don't currently have time to find a full solution, so just wondering if anyone else has implemented the same...
I have a class which extends JPanel and adds a "wait(boolean)" method - when called with 'true' this kicks off a Timer which repaints with an animated overlay until it is called again with 'false.' The overlay is simply painted, it's not an actual component.
All well and good so far.
However, what I'd like to do is also disable mouse/key/etc events within that panel. Let's say one of the components which it contains is a table - I don't want the user to be able to change the selected row whilst the panel is in 'wait mode.'
Since Swing uses a bubble-up event model, this isn't trivial - the on-liner solutions such as calling setEnabled() or overriding processEvent() won't work because the component itself doesn't actually receive the events.
So, the solutions off the top of my head are,
1. when wait is called, lock and traverse the tree and disable/enable all the components within it - not a good solution as this disrupts the state of the components and even if a map is maintained, and changes to the hierarchy during wait mode will cause trouble
2. use the panel as a container for a wrapped panel plus an overlay which is only visible during wait mode, delegate various methods to the wrapped panel - I don't like this as it means overriding a whole truckload of methods and it feels fragile
3. when wait is called, inject an overlay panel into the component tree - I don't like this either as it means understanding the panel's context in its parent (eg it might be the center of a BorderLayout or it might be the left component in a JSplitPane) and it also has obvious implications for events such as ComponentEvent on the children
4. wrap a panel as per 2 and instead of delegating, simply provide a "getPanel()" method to obtain it - perfectly functional but utterly ugly and it allows people to easily and comprehensively break the behaviour if they wish
I can't help feeling there's something obvious I'm missing :o) ...I'm thinking more along the lines of a composition model rather than extension now, but I think I fundamentally still have similar issues.
Anyone got any ideas?

I've had a chance to play with this now and I had a pop at using the JLayeredPane, throwing a component to the top which is a MouseListener and KeyListener and consume()s all the events. Works fine for the most part, until there's a JButton within the component - they manage to carry on handling events despite the consuming component over the top of them. Hover over them and they repaint, they're clickable, and so on. Hmm.

Similar Messages

  • Drag a container and its children

    Hi,
    How do i drag a container and its children? 
    I see you can drag something and its parent, but i don't see how you can get the child from the draginitiator. 
    Thanks

    I've had a chance to play with this now and I had a pop at using the JLayeredPane, throwing a component to the top which is a MouseListener and KeyListener and consume()s all the events. Works fine for the most part, until there's a JButton within the component - they manage to carry on handling events despite the consuming component over the top of them. Hover over them and they repaint, they're clickable, and so on. Hmm.

  • I have forgotten my passcode for my iphone and its now saying "iPhone is disabled connect to itunes" but i need to get in the phone to do anything first but i cant !!! please help me i will be so greatful

    i have forgotten my passcode for my iphone and its now saying "iPhone is disabled connect to itunes" but i need to get in the phone to do anything on itunes !!! please help me i will be so greatful

    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device: Several Alternative Solutions
    1. iOS- Forgotten passcode or device disabled after entering wrong passcode
    2. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    3. Restoring iPod touch after forgotten passcode
    4. What to Do If You've Forgotten Your iPhone's Passcode
    5. iOS- Understanding passcodes
    6. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    Forgotten Restrictions Passcode Help
    You will need to restore your device as New to remove a Restrictions passcode. Go through the normal process to restore your device, but when you see the options to restore as New or from a backup, be sure to choose New.
    Also, see iTunes- Restoring iOS software.

  • Accessing to Windows Server 2003 SP2 R2 32-bit from a Windows XP SP3 32-bit leaves a fork of the explorer and its children processes !!!

    When I try to access to Windows Server 2003 SP2 R2 32-bit from a Windows XP SP3 32-bit and then closes the RDP from Windows XP (the client side), a fork of the explorer and its children processes will persist in the server side !!!
    Take a look at the screenshot to understand:
    is this normal behavior !?
    Thank you for your understanding ;)

    Hi,
    I think this is normal behavior.
    You just close the RDP from client side but not log off the server, right?
    Regards.
    Vivian Wang
    Yes, right I closed the RDP from client side, not log off the server.

  • Report for Asset number and its Purahcse order number

    Hello Friends,
    Please give me details of report for Asset number and its Purchase order number .
    Regards
    Nilesh Vakil

    hi,
    GO to ME2N...
    use SHIFT + F4..
    there check for the acc. assign cata. field and input the asset  and execute..
    Regards
    Priyanka.P

  • I have been offered cc 2014 for 29.99 and its says contact the support team to see if I qualify - trying to get to the support team option by telephone just seems to send me in a loop - getting pretty disgusted with all the rigmarole just to get a somethi

    I have been offered cc 2014 for 29.99 and its says contact the support team to see if I qualify - trying to get to the support team option by telephone just seems to send me in a loop - getting pretty disgusted with all the rigmarole just to get a something

    This is an open forum, not Adobe support... you need Adobe staff to help
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"
    -or by telephone http://helpx.adobe.com/x-productkb/global/phone-support-orders.html

  • How do I disable transparency for the menubar and addressbar in firefox?

    How do I disable transparency for the menubar and addressbar in firefox? (This does not mean disable windows aero or transparency in windows 7. A workaround has been posted. Stop spamming threads with disable transparency and aero everytime someone asks about this.)
    It is difficult to read.
    Edit:
    Is there a setting to tone down the Aero usage of the in Firefox 5 so it looks more like Firefox 3.6. Is there a way to do this in the preferences or inside about:config?
    I know what Aero is and how to turn it off.
    The 2nd reply has images attached show why it is difficult to read. An light spot on a desktop background or an icon can make it very difficult to read. This is the #1 reason why I keep going back to 3.6.

    If you are up to tweaking some CSS code in a style see
    "Color Toolbar(s) to identify profile (DM*)" -- in http://userstyles.org/styles/9514, and you must read all of the description material understand what has to be done.
    It is a style, and playing with the code is what styles are about. You will have to copy the section of code in the description to the bottom of the style for it to be complete to remove additional Aero effects, and choose two or three colors for the toolbars.

  • Copy Parent and its children records

    Hello:
    I have a requirement to implement the "deep copy" functionality i.e. copy Opportunity and its children records including Contact, Opportunity Product Revenue etc. Can this be accomplished with the weblink, web services or any other options? I have went over the Oracle web services Guide doc, but I am still not sure what steps need to take in order to implement this "deep copy" functionality. Could you direct me to any reference docs to implement this?
    Thanks in advance!
    -AJ

    Briefly, it looks like this.
    "Deep copy", as you describe it, can be just a programmatic manipulation of data via WebServices. So your program would go through these steps:
    - login to WS (or use stateless sessions)
    - use Query method on Opportunity object Web Service to retrieve all fields from the record, and all child records
    - create new Opportunity record, by calling Insert method
    - create child records of all types you need, also by calling Insert method (in WS 1.0 you will use InsertChild)
    Exact details depend on your programming language.
    You may need to use both 1.0 and 2.0, or select which version to use, because these two interface support different child objects.
    In any case, there is no way to create both parent and children in one call - you create Opportunity record, and then reference its ID in new child objects.
    Hope it helps.

  • Script to disable Client for Microsoft Networks and File and Print Sharing for Microsoft Networks

    Hi, I am trying to find a way of using a batch file or vbscript to disable Client for Microsoft Networks and File and Print Sharing for Microsoft Networks on a Network Interface Controller.
    I've done some searching on the internet and I can see some suggestions to locate the Setting ID of the NIC and then remove the value from the "Bind" string under "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Linkage" and "HKLM\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Linkage"
    I tried this but it didn't seem to uncheck itself from the NIC properties under NCPA.cpl
    Can someone help me? 

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/b0407073-07bc-462b-9de9-7295be5fa183/disable-file-and-printer-sharing-for-mircorosoft-networks?forum=csharpgeneral
    ¯\_(ツ)_/¯

  • HT1296 To sync contacts with my computer, I choosed "Sync Contacts with" within iTunes for Windows Outlook and Its suncking but contact is not showing in the Oulook contact.

    To sync contacts with my computer, I choosed "Sync Contacts with" within iTunes for Windows Outlook and Its suncking but contact is not showing in the Oulook contact.

    Do changes/additions to the contacts list in Outlook appear on the iPhone?

  • Utilities:Events for device installation and replacement

    Hi all,
    i need to know the events for device installation and device installation replacement.
    please help urgent help required.
    Thanks,
    Anand.

    >events for device installation
    1. An installation order for a device or a device group is created in the Service Management (PM-SMA) application component. This may result from a company requirement (such as a switching change) or an external requirement (new connection),                                             
    2. The installation order is executed and returned.                                             
    3. The removal of the device is entered in IS-U.                                             
    >device installation replacement
    1. A replacement order is created for a device or a device group in the Service Management (PM-SMA) application component. This may result from a company requirement (such as a switching change) or an external requirement (such as a change in use of the object).                                             
    2. The replacement order is executed and confirmed.                                             
    3. The replacement of the device or of all devices in a device group is entered in IS-U.
    Regards,
    Dharani

  • I have been having trouble connecting to my wifi on my ipad mini but my iPod is just fine......it will connect and then say "Unable to connect to network" I've tried resetting my ipad mini and turning off my router for 30 seconds and its not working.

    I have been having trouble connecting to my wifi on my ipad mini but my iPod is just fine......it will connect and then say "Unable to connect to network" I've tried resetting my ipad mini and turning off my router for 30 seconds and its not working.

    What TC do you have? Model number direct from the base is a big help, it will be A1 followed by 3 numbers.. eg
    A1409 Gen 4.. The new AC is A1470
    How is it setup?
    I need the whole network setup. what modem/router, how is the TC connected etc??
    I also need to know what IP the ipod gets, so I can see what mode the TC or network router is working in.

  • HT4557 I'm trying to set up my iphone for home sharing and its says unable to set up home sharing. My password is correct, I've tried it three times with the same message. Any help?

    I'm trying to set up my iphone for home sharing and its says unable to set up home sharing. My password is correct, I've tried it three times with the same message. Any help?

    Hello daltonfromgbr
    Check out the article below to troubleshoot you issue with connecting to Home Sharing. It will walk you through checking firewall settings as well as your network connection.
    Troubleshooting Home Sharing
    http://support.apple.com/kb/ts2972
    Regards,
    -Norm G.

  • Im keep on getting your app store id has been disabled. i change the password and its still doing it

    im keep on getting your app store id has been disabled. i change the password and its still doing it

    Check with iTS to see why.
    iTunes Store Support
    http://www.apple.com/emea/support/itunes/contact.html

  • Hi,I have uploaded an app build for pre release  and its still under processing So i uploaded a new build but still the issues is not resolved.Please help...Thanks

    Hi,
    I have uploaded an app build for pre release  and its still under processing So i uploaded a new build but still the issues is not resolved.
    Please help...
    Thanks

    Hi smithin, 
    Thanks for visiting Apple Support Communities. 
    It sounds like you've submitted an iOS application to the App Store, which is being processed, but there's an unresolved issue.
    For additional help with this situation, Apple Developers can use the contact methods on this page:
    https://developer.apple.com/contact/
    All the best,
    Jeremy 

Maybe you are looking for