+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import java.awt.EventQueue;
public class AddCustomerInfoInternalFrame extends JInternalFrame { /**
 * Launch the application.
 */ /**
 * Create the frame.
 */

public AddCustomerInfoInternalFrame() {
//创建一个新的窗口类
//设置(右上角)关闭键
setClosable(true);
try {
setClosed(true);
} catch (PropertyVetoException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//设置(右上角)最大化键
setMaximizable(true);
//设置(右上角)最小化键;
//P可以“图标化”窗体(缩小并显示为图标图像)。
setIconifiable(true);
//title名
setTitle("用户信息注册");
//窗口的大小
setBounds(0, 0, 450, 250);
//放一块玻璃在窗口上,
//Pf返回此内部窗体的内容窗格。getContentPane()
//pa设置此组件 layer 属性的便捷方法。setLayout(null)
getContentPane().setLayout(null);

/*用于短文本字符串或图像或二者的显示区。标签不对输入事件作出反应。
 * 因此,它无法获得键盘焦点。
 * 但是,标签可以为具有键盘替换功能却无法显示的邻近组件方便地显示其键盘替换功能。 */
JLabel lblNewLabel = new JLabel("用户注册");

/*类 java.awt.Component 中的方法 
移动组件并调整其大小。 */
lblNewLabel.setBounds(86, 102, 133, 46);
//往玻璃中添加
getContentPane().add(lblNewLabel);
}
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JDesktopPane;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import java.beans.PropertyVetoException;
public class MainFrame extends JFrame { private JDesktopPane jDesktopPane;
private AddCustomerInfoInternalFrame addCustomerInfoInternalFrame;
private AddGoodsInternalFrame addGoodsInternalFrame; /**
 * Launch the application.
 */
public static void main(String[] args) {
/*invokeLater(Runnable runnable) 
导致 runnable 的 run 方法在 the system EventQueue 的指派线程中被调用。*/

/*EventQueue 是一个与平台无关的类,
 * 它将来自于底层同位体类和受信任的应用程序类的事件列入队列。 
它封装了异步事件指派机制,该机制从队列中提取事件,
然后通过对此 EventQueue 调用 dispatchEvent(AWTEvent)
// 
//dispatchEvent(AWTEvent) 
//指派一个事件。指派事件的方式取决于事件的类型和事件的源对象的类型: 
//
方法来指派这些事件(事件作为参数被指派)。
该机制的特殊行为是与实现有关的。指派实际排入到该队列中的事件
(注意,正在发送到 EventQueue 中的事件可以被合并)的唯一要求是: 
*/
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainFrame frame = new MainFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} /**
 * Create the frame.
 */
public MainFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
jDesktopPane = new JDesktopPane();
jDesktopPane.setBackground(Color.LIGHT_GRAY);
jDesktopPane.setSize(450, 250);
jDesktopPane.setLocation(0, 0);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(jDesktopPane,BorderLayout.CENTER);

JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);

JMenu menu = new JMenu("用户信息管理");
menuBar.add(menu);

JMenuItem menuItem = new JMenuItem("信息注册");
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if(addCustomerInfoInternalFrame == null){
addCustomerInfoInternalFrame = new AddCustomerInfoInternalFrame();
}
if(addCustomerInfoInternalFrame.getDesktopPane() == null){
jDesktopPane.add(addCustomerInfoInternalFrame);
}
//————————————————————————————————————————————————————
if(addCustomerInfoInternalFrame!=null&&addCustomerInfoInternalFrame.getDesktopPane()!=null){
addCustomerInfoInternalFrame.setVisible(true);
addCustomerInfoInternalFrame.setLayer(1);
}
//————————————————————————————————————————————————————
//最小化窗口以后,我想干的事就是:当鼠标再次触法菜单中已经打开并且最小化窗口的时候,
//最小化窗口可以还原-----------高手求解
//————————————————————————————————————— addCustomerInfoInternalFrame.setLayer(2);
addCustomerInfoInternalFrame.setVisible(true);
addCustomerInfoInternalFrame.setLayer(1);
}
});
menu.add(menuItem);

JMenu menu_1 = new JMenu("商品信息管理");
menuBar.add(menu_1);

JMenuItem menuItem_1 = new JMenuItem("添加商品");
menuItem_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if(addGoodsInternalFrame == null){
addGoodsInternalFrame = new AddGoodsInternalFrame();
}
if(addGoodsInternalFrame.getDesktopPane() == null){
jDesktopPane.add(addGoodsInternalFrame);
}

addGoodsInternalFrame.setLayer(2);
addGoodsInternalFrame.setVisible(true);
addGoodsInternalFrame.setLayer(1);
}
});
menu_1.add(menuItem_1); }}