Hi all, I get the following error when I try to drag a JInternalFrame which is inside a JDesktopPane. I think this is because I am adding a JInternalFrame to a container before it is viewed. The reason I add it to a container is I have set the DesktopPane layout to BorderLayout and the container is in the BorderLayout.CENTER region which is where I want the JInternalFrame to appear. The container keeps the JInternalFrames the correct size. My question is what can I use instead of a awt.container to hold my JInternalFrames?? Exception occurred during event dispatching: java.lang.ClassCastException: java.awt.Container at javax.swing.DefaultDesktopManager.dragFrameFaster(DefaultDesktopManager.java:533) at javax.swing.DefaultDesktopManager.dragFrame(DefaultDesktopManager.java:280) Any help would be greatly appreciated Thanks, Patrick.
The way to add JInternalFrames to a JDesktopPane is as follows:
Hope that helps a little. To answer your question, you set the JDesktopPane as the ContentPane of your JFrame. This uses a SWING Container for the JInternalFrames. There are a few elements missing from the code, like a Window Listener for your JFrame and things like that, but this should give you a general idea. [ February 13, 2002: Message edited by: Gregg Bolinger ]