重写paint()方法后Frame背景图片不显示
用JFrame做
URL url1 = urlload.findResource("Images/background.jpg"); Image img1 = Toolkit.getDefaultToolkit().getImage(url1); backgroundLabel = new JLabel(new ImageIcon(img1)); this.getLayeredPane().add(backgroundLabel, new Integer(Integer.MIN_VALUE)); backgroundLabel.setBounds(0,0,800,600); ((JPanel)getContentPane()).setOpaque(false); setVisible(true);public void paint(Graphics g){ super.paint(g);// do your thing....}