box1.add(Box.createVerticalStrut(8)); box1.add(new Label("数学:")); box1.add(Box.createVerticalStrut(8)); box1.add(new Label("英语:")); box3 = Box.createHorizontalBox(); box3.add(box1); box3.add(Box.createHorizontalStrut(1)); box3.add(box2); show = new TextArea(6, 43); sure = new Button("确定"); box4 = Box.createHorizontalBox(); Label label1 = new Label("请输入数据"); label1.setFont(new Font("宋体", Font.BOLD, 20)); label1.setForeground(Color.blue); box4.add(label1); box4.add(Box.createHorizontalStrut(1)); box4.add(sure); sure.addActionListener(this); bg = new ImageIcon("cru.jpg"); JLabel label = new JLabel(bg); label.setBounds(0, 0, bg.getIconWidth(), bg.getIconHeight()); imagePanel = (JPanel) frame.getContentPane(); imagePanel.setOpaque(false); imagePanel.setLayout(new FlowLayout()); show.setEditable(false); imagePanel.add(box4, BorderLayout.NORTH); imagePanel.add(box3, BorderLayout.CENTER); imagePanel.add(show, BorderLayout.SOUTH); frame.getLayeredPane().setLayout(null); frame.getLayeredPane().add(label, new Integer(Integer.MIN_VALUE)); //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(bg.getIconWidth(), bg.getIconHeight()); frame.setBounds(700, 200, 540, 440); frame.setResizable(false); frame.setVisible(true); validate(); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { dispose(); } }); 6