JInternalFrame  with isShowing() broken?

Hi all,
I've confirmed (I think) that the following is true:
When a JInternalFrame becomes completely obscured by another, isShowing (& isVisible) still returns true for child components.
This cannot be the correct behavior, can it?
This is a real problem for my code, whcih needs to ensure that a paint event always occurs after a specific kind of model update occurs. My code checks for wether the component is visible and then request the reapint and confirms that the paint has occurred. That is, I need some mechanism to test wether the paint will occur on a repaint. This has always worked fine for JFrmaes, buit is broken for JInternal Frames.
Am I missing something here?
Worst case, does anyone know of any work arounds for this problem? I've thought about overriding the desktop manager to force the setVisible flag to false when one frmae obscrues another (the hard part is putting it back!) but the complexity and performance hit of this seems unacceptable.

OK, no responses so I wrote my own implementation that simply sets visible to false when any frame within the desktop is obscured. Turned out to be a lot of code but althgouh it looks complex, the performance is fine even w/ many windows displayed. Here's the intial bit for those interested, not perfected yet. Comments welcome and I hearby award myself back 6 points. I'll leave the other 4 open for a while in case anyone has a better solution or more info.
        desktop.setDesktopManager(new DefaultDesktopManager() {
            Rectangle lastBounds;
            public void activateFrame(JInternalFrame f) {
                super.activateFrame(f);
                calculateVisibility();
            public void closeFrame(JInternalFrame f) {
                super.closeFrame(f);
                calculateVisibility();
            public void deactivateFrame(JInternalFrame f) {
                super.deactivateFrame(f);
                calculateVisibility();
            public void deiconifyFrame(JInternalFrame f) {
                super.deiconifyFrame(f);
                calculateVisibility();
            public void iconifyFrame(JInternalFrame f) {
                super.iconifyFrame(f);
                calculateVisibility();
            public void maximizeFrame(JInternalFrame f) {
                super.maximizeFrame(f);
                calculateVisibility();
            public void minimizeFrame(JInternalFrame f) {
                super.minimizeFrame(f);
                calculateVisibility();
            public void openFrame(JInternalFrame f) {
                super.openFrame(f);
                calculateVisibility();
            public void dragFrame(JComponent f, int newX, int newY) {
                super.dragFrame(f, newX, newY);
                calculateVisibility();
            public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) {
                super.setBoundsForFrame(f, newX, newY, newWidth, newHeight);
                calculateVisibility();
        desk.addComponentListener(new ComponentAdapter() {
             public void componentResized(ComponentEvent e) {
                 calculateVisibility();
    private void calculateVisibility() {
         JInternalFrame[] frames = desk.getAllFrames();
         for (int i = 0; i < frames.length; i++) {
             JInternalFrame frame = frames;
if (!frame.isIcon()) {
Component[] c = frame.getContentPane().getComponents();
for (int j = 0; j < c.length; j++) {
Component component = c[j];
if (desk.getBounds().intersects(calculateBoundsInFrame(component))) {
component.setVisible(true);
else {
//off desktop
component.setVisible(false);
for (int i = 0; i < frames.length; i++) {
JInternalFrame frame1 = frames[i];
if (!frame1.isIcon()) {
for (int j = 0; j < frames.length; j++) {
JInternalFrame frame2 = frames[j];
if (!frame2.isIcon()) {
//Is frame 1 in front of frame 2?
if (desk.getIndexOf(frame1) < desk.getIndexOf(frame2)) {
Component[] c = frame2.getContentPane().getComponents();
for (int k = 0; k < c.length; k++) {
Component component = c[k];
if (frame1.getBounds().contains(calculateBoundsInFrame(component))) {
component.setVisible(false);
private Rectangle calculateBoundsInFrame(Component component) {
Rectangle componentBoundsInFrame = component.getBounds();
//This only works in the simplest case, need to recurse to JInternalFrame
Point p1 = component.getParent().getLocation();
Point p2 = component.getParent().getParent().getLocation();
Point p3 = component.getParent().getParent().getParent().getLocation();
Point p4 = component.getParent().getParent().getParent().getParent().getLocation();
componentBoundsInFrame = new Rectangle(p1.x + p2.x + p3.x + p4.x, p1.y + p2.y + p3.y + p4.y, componentBoundsInFrame.width, componentBoundsInFrame.height);
componentBoundsInFrame = componentBoundsInFrame.intersection(desk.getBounds());
return componentBoundsInFrame;

Similar Messages

  • How do i transfer my musiclibrary from my iphone to a new computer since the computer the iphone is synct with is broken and no longer works

    if the computer your music library is synct with  is broken how do y transfer your music on your iphone to a new itunes on a new computer

    1. Disable automatic syncing on connection:  iTunes Prefs > Devices > Disable....
    2. Connect phone.
    3. Right-click the device tab on left border of iTunes window and select "Transfer Purchases."  This will transfer all iTunes store purchased music, media and apps to the iTunes library on the computer. 
    It won't transfer non-iTunes store music/media (i.e. CD's you ripped  yourself) and these will get deleted from the phone when you sync.  There are 3rd party apps for your computer which may be able to backup non-iTunes media on your phone.  Google.

  • I need to install the HP drivers on a laptop with a broken screen in order to get VGA port to work.

    OS: Windows 7 Home Premium SP1
    Hewlett Packard Model: 2000 2a20ca Notebook
    Oh my god please give me some insight here, it is so hard to find the right answers and I refuse to lose to this technical box that's driving me nuts! So here's the run down:
    My screen broke on laptop...fine. It was connected via HDMI to TV and working fine. Until one day it decided to not turn on. I think due to Windows updates and hubby had no patience so kept restarting
    I tried to reload Windows on it, not thinking about the drivers, and I'm pretty sure I managed to reload Windows. Now I need the drivers to install chipset, networking etc. (which I have a disc for)
    The problem is I cannot see the screen in order to click "install", I can't see the BIOS or the boot sequence. Ugh! And even if I could, the drivers are not installed to use the CD ROM or VGA port.
    I can HEAR Windows start up and turn on! Doo-DO-Doo-DO lol the darn thing is working!
    The monitor works in my other laptop.
    Would/Should the VGA monitor work if I could get it to start in safe mode?
    I've heard of a program that can streamline the driver's into a Windows installation disc so everything is installed altogether but how can I reinstall Windows if the drivers aren't loaded for the CD ROM?
    Is there a way to get the necessary drivers installed? or is this notebook now garbage?

    RocknRoll77 wrote:
    Seriously? 
    1.  The model number is the first thing at the top aside from the OS.
    2.  In my explanation it states:  "I have the drivers on a disk"
    Thanks for all your help!
    Getting the drivers is not the problem.  Getting the drivers installed on a laptop with a broken screen...is the problem.
    Ok, well sometimes you can't use external monitor to see what is happening in some laptops and the only real way to fix this is to fix the broken screen so you can reformat and resinstall the system again. Those are you only options at this point in time.
    I am a Volunteer to help others on here-not a HP employee.
    Replies aren't online 24/7 because of Time Zone differences.
    Remember in this Day and Age of Computing the Internet is Knowledge at your fingertips if you choose understand it. -2015-

  • How do I use an external Monitor to access files on my iMac with a broken screen?

    I have an 20 inch desktop iMac with a broken screen. It is the files on the computer that I wish to recover, after that, I can be on my merry way. Unfortunately, VileVault was on (Not my choice), and for some reason, when I target the disc image of the broken mac with a new one, ONE of the accounts "appears" to be completely empty. All of the accouts were running FileVault, but only one (mine) failed to be transferred because it is "empty". I refuse to believe that my files are actually all gone, because theoretically there should be nothing wrong with the CPU itself, just the screen.
    Thus my goal is to use a monitor on my broken screen iMac and simply log in and access my files normally, and perhaps pull them out with a USB or something. I have a DELL monitor, and a DVI (The big hairy plug with screws I think) converter that works with my old iMac, along with the male/male DVI cord. However, when I hook it up, nothing happens. I have tried booting the old CPU while holding F7, and option as I read on a forum, and neither produced results.
    Does anyone have any ideas on how to 1. Get the monitor to simply show what's going on on the mac? or 2. Pull out my files through some other means?
    Thank you.

    If you have a second Mac computer, you may want to try to copy over as many files you can. One way is to use target disk mode.
    http://support.apple.com/kb/HT1661
    http://lowendmac.com/misc/06/0710.html
    You need to follow this procedure to recovering a filevault id.  Mac OS X 10.3, 10.4: FileVault - How to verify or repair a home directory image ...  http://support.apple.com/kb/HT2631?viewlocale=en_US  
    Robert

  • How can I get to DFU mode with a broken power button?

    How can I get to DFU mode with a broken power button?

    aarons84 wrote:
    This is bad, but i tried jailbraking my iphone
    You may as well stop there. We can't help you.

  • The computer I usually pair my iphone 4 with has broken.  How do I set it up to pair with my other computer without losing the applications and songs already purchased on the iphone?

    The computer I usually pair my iphone 4 with has BROKEN.  How do I change the pairing to another computer.  I tried to pair it to my other computer and it tells me I have to delete everything on the iphone to continue.  I have alot of items purchased so I dont want to do that?  Can someone please help me.

    Read http://support.apple.com/kb/HT4236

  • HT4623 My iPod Touch is te 4th generation with iOS 4 only... The desktop that it used to connect with was broken and I couldn't update my iPod touch as all content is linked to the iTunes on that broken PC. What should I do?I won't erase all my music reco

    My iPod Touch is te 4th generation with iOS 4 only... The desktop that it used to connect with was broken and I couldn't update my iPod touch as all content is linked to the iTunes on that broken PC. What should I do?I don't want to erase all my music recording. (couldn't back up easily...) my dairy, my financial record made on apps...
    If I got a new Mac book pro soon, would it helps backuping everything?

    awesome121, he does not an an iCloud account. You need iOS 5 or later for iCloud and the poster said he has iOS 4.
    awesome121 wrote:
    DO you have a icloud account?

  • HT1386 The laptop I originally synch'd my iphone 4s with is broken and cannot retrieve any files. How can I sync the phone with a new laptop without losing all my downloaded music and apps already installed on my iphone?

    The laptop I originally synch'd my iphone 4s with is broken and cannot retrieve any files. How can I sync the phone with a new laptop without losing all my downloaded music and apps already installed on my iphone?

    If the answer to the above question is "yes", FIRST, set up a backup of your new computer before you do anything else so the next time your computer breaks you will not be in the same situation. Backup solutions are numerous and inexpensive, and there is absolutely no excuse in the Third Millennium not to have one.
    Then see this tip: https://discussions.apple.com/docs/DOC-3141

  • How is it possible to install Windows 7 via USB-Stick on a 2009 iMac with a broken DVD-Drive?

    Hello,
    i have a 2009 iMac and Windows 7 64bit in my Boot Camp.
    Windows is now slow and needs to be reinstalled.
    The problem is the DVD-Drive in my iMac is broken, so i can't use my Windows-install-DVD.
    How can i reinstall Windows 7 via USB-Stick on a 2009 iMac with a broken DVD-Drive?

    F3Spirit wrote:
    Thank you,
    I try this.
    Also check this one out
    But i think you would be far better served by installing Windows in a virtual machine.

  • HT201263 i need to get my iphone into recovery mode with a broken home button and is disabled, my exgirlfriend has the laptop i synced it with, what should i do??

    i need to get my iphone into recovery mode with a broken home button and is disabled, my exgirlfriend has the laptop i synced it with, what should i do??

    i have the same probelm did u get it solved if yess how ?

  • I have a 2006 15" Macbook Pro with a broken Superdrive and my external USB one just quit working

    Why can my LG Portable Super Multi Drive (GP08NU6B) burn discs, but not read them? Right after I burn a DVD successfully, I stick it back in the drive and it says "The disk you have inserted is not readable by this computer"  I have a 2006 15" Macbook Pro with a broken Superdrive, and this external disk drive is the only optical drive that worked via USB.  This external drive was bought in 2010 and worked fine up until a month ago. This is supposed to be a Plug and Play device, and LG assures me the drivers are already included in Mac OSX,  yet it seems somehow my Macbook lost the drivers and it won't let me watch DVDs now or recognize any discs at all!
    How can I find and somehow reinstall the firmware for this optical drive?

    Sounds more like a hardware issue to me.

  • HT1212 my ipod touch has been disabled and needs to be plugged into itunes to reset it. However, the computer it was last synched with has broken and I don't know what to do!

    my ipod touch has been disabled and needs to be plugged into itunes to reset it. However, the computer it was last synched with has broken and I don't know what to do!

    You need to place the device in recovery mode.
    Instructions here >  iOS: Unable to update or restore
    "If you restore on a different computer that was never synced with the device, you will be able to unlock the device for use and remove the passcode, but your data will not be present"

  • I have an ipod touch 4th generation with a broken digitizer. can it connect to itunes?

    i have an ipod touch with a broken digitizer. can it still connect to itunes?

    See
    iPhone, iPad, or iPod not recognized in iTunes for Windows
    - I would start with
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    or                                                                                                                                  
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    However, after your remove the Apple software components also remove the iCloud Control Panel via Windows Programs and Features app in the Window Control Panel. Then reinstall all the Apple software components
    - Then do the other actions of:
    iOS: Device not recognized in iTunes for Windows
    paying special attention to item #5
    - New cable and different USB port
    - Run this and see if the results help with determine the cause
    iTunes for Windows: Device Sync Tests
    Also see:
    iPod not recognised by windows iTunes
    Troubleshooting issues with iTunes for Windows updates
    - Try on another computer to help determine if computer or iPod problem

  • How much is the exchange for iphone 5s with a broken screen? in Brazil charged me R$ 999.00

    How much is the exchange for iphone 5s with a broken screen? in Brazil charged me R $ 999.00

    If the device has not been opened by anyone (other than Apple) then it can be replaced via the Out of Warranty replacement program, $269US for the 5, 5C, and 5S?
    If it has been opened by anyone other than Apple, purchase a new device.

  • Re-Setting phone setting with a broken screen???

    Hi,
    Is it possible to re-set the original factory setting on my Curve 8900 with a broken screen? I'm wanting to sell it on ebay but not with all my personal stuff on.
    Thanks
    Phil

    How to delete all data on a BlackBerry
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

Maybe you are looking for