package demo;public class demo_01 {private JDesktopPane desktopPane;private JFrame frame;private JLabel backLabel;private JPanel myPanel;public Toolkit toolkit = Toolkit.getDefaultToolkit() ;public Dimension sc = toolkit.getScreenSize() ;public JLabel name1 = new JLabel("姓 名") ;public JTextField textName1 = new JTextField() ;public Font font1 = new Font("宋體",4,25) ;public demo_01(){frame = new JFrame("測試");frame.addComponentListener(new ComponentAdapter(){public void componentResized(ComponentEvent e){backLabel.setSize(frame.getWidth(),frame.getHeight());backLabel.setText("<html><body><image width='"+frame.getWidth()+"'height='"+(frame.getHeight()-110)+"'src="+demo_01.this.getClass().getResource("tianxiexinxi.jpg")+"'></img></body></html>");}});frame.getContentPane().setLayout(new BorderLayout(5,5));frame.setBounds(0,0,2550,1440);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);backLabel=new JLabel();backLabel.setVerticalAlignment(SwingConstants.TOP);backLabel.setHorizontalAlignment(SwingConstants.CENTER);frame.setLayout(new BorderLayout(5,5));name1.setForeground(Color.blue);name1.setSize(200,70);name1.setFont(font1) ;name1.setLocation(420, 210);frame.add(name1,BorderLayout.CENTER);name4.setForeground(Color.blue);textName1.setBounds(540, 227, 400, 33);frame.add(textName1);desktopPane=new JDesktopPane();desktopPane.add(backLabel,new Integer(Integer.MIN_VALUE));frame.getContentPane().add(desktopPane);//完成JButton icon1=new JButton(new ImageIcon("res/wancheng.png"));myPanel = new JPanel();myPanel.add(icon1);myPanel.setSize(414, 129);frame.add(myPanel);icon1.setSize(414,129);icon1.setLocation(0, 0);frame.setVisible(true);}public static void main(String[] args) {// TODO Auto-generated method stubSwingUtilities.invokeLater(new Runnable(){@Overridepublic void run() {// TODO Auto-generated method stubnew demo_01();}});}}