ComponentListener works in Java 1.5, not in Java 1.6

10-11  Source: Network gathering  Views:3 

Advertisement
Hi there,
I'm having an odd problem. I have a GUI application that has a JFrame with a JDesktopPane as its content pane, with several sub-windows (JInternalFrames).
The master JFrame listens for when a JInternalFrame closes and performs an action. Each JInternalFrame executes:
addComponentListener(parent);The JFrame (parent) implements ComponentListener and includes:
    public void componentHidden(ComponentEvent e) {
         System.out.println(e.getComponent().getClass().getName());
         dostuff();
    }This works fine with Java 1.5. But if I compile a .jar and run it on Java 1.6, componentHidden is never called.
Any suggestions?
Many thanks,
Peter.
Hello there!
I've been experiencing similar problem. As the author of the original post I have JFrame and JDesktopPane on it. I have several JInternalFrames. Internal frame has BorderLayout. I have two JPanels, that I want to add to Internal frame (one at a time). Other JPanel is removed and made invisible by calling setVisible(false). When I am adding JPanel to internal frame and calling method setVisible(true), componnetShown method is called as it should be. When I call method setVisible(false) and remove JPanel, method componentHidden is not called. I did workaround by calling active_panel.getComponentListeners()[0].componentHidden(null) at the time when setVisible(false) is called, but I do not like that. I'd like to know if I am misunderstanding something or if it is a bug.
Related articles