Prueba con este código:
- import javax.swing.JInternalFrame; 
- import javax.swing.JDesktopPane; 
- import javax.swing.JMenu; 
- import javax.swing.JMenuItem; 
- import javax.swing.JMenuBar; 
- import javax.swing.JFrame; 
- import java.awt.event.*; 
- import java.awt.*; 
- import java.beans.PropertyVetoException; 
-   
- public class-  UCIChess  extends JFrame {
 
-   
- 	static int openFrameCount = 0; 
- 	MyInternalFrame myInternalFrame; 
-   
-         public UCIChess() { 
- 		super("JInternalFrame Usage Demo"); 
- 		// Make the main window positioned as 50 pixels from each edge of the 
- 		// screen. 
- 		int inset = 50; 
- 		setBounds(inset, inset, screenSize.width - inset * 2, 
- 				screenSize.height - inset * 2); 
- 		// Add a Window Exit Listener 
-   
- 			} 
- 		}); 
-   
-                         if(-  e. getKeyCode() == KeyEvent- . VK_ENTER ){
 
-                             try { 
-                                 myInternalFrame.setClosed(true); 
-                                 myInternalFrame.dispose(); 
-                                 System- . err- . println("Closing Exception");
 
-                             } 
-                         } 
-                     } 
-                 }); 
- // Create and Set up the GUI. 
- 		// A specialized layered pane to be used with JInternalFrames 
- 		createFrame(); // Create first window 
- 		setContentPane(jdpDesktop); 
- 		setJMenuBar(createMenuBar()); 
- 		// Make dragging faster by setting drag mode to Outline 
- 		jdpDesktop.putClientProperty("JDesktopPane.dragMode", "outline"); 
- 	} 
-   
- 				createFrame(); 
- 			} 
- 		}); 
-   
- 		menu.add(menuItem); 
- 		menuBar.add(menu); 
- 		return menuBar; 
- 	} 
- 	protected void createFrame() { 
- 		myInternalFrame = new MyInternalFrame(); 
- 		myInternalFrame.setVisible(true); 
- 		// Every JInternalFrame must be added to content pane using JDesktopPane 
- 		jdpDesktop.add(myInternalFrame); 
- 		try { 
- 			myInternalFrame.setSelected(true); 
- 		} 
- 	} 
- 	public static void-  main (String[]-  args ) {
 
- 		UCIChess frame = new UCIChess(); 
- 		frame.setVisible(true); 
- 	} 
-   
- 		static final int xPosition = 30, yPosition = 30; 
- 		public MyInternalFrame() { 
- 			super("IFrame #" + (++openFrameCount), true, // resizable 
- 					true, // closable 
- 					true, // maximizable 
- 					true);// iconifiable 
- 			setSize(300, 300); 
- 			// Set the window's location. 
- 			setLocation(xPosition * openFrameCount, yPosition 
- 					* openFrameCount); 
- 		} 
- 	} 
- } 
lo bajé de 
aqui y lo modifiqué tantito.