private BufferedImage backImage=null;
try {
backImage=ImageIO.read(new File("src/Images/渐变色3.jpg"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
public void paint(Graphics g) {
g.drawImage(backImage, 0, 0, this);
}
重写paint()方法,绘制背景图片。