帮忙解决一下,为什么绘制不了图片?那里错了、、、、
public class Test extends JFrame {private JPanel contentPane;
public static void main(String[] args) {
Test frame = new Test();
}
public Test() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
Image img = new ImageIcon("images/1.jpg").getImage();
BufferedImage buImage = new BufferedImage(450,
300, BufferedImage.TYPE_INT_ARGB_PRE);
Graphics graphics = buImage.getGraphics();
graphics.drawImage(img, 0, 0, 450, 300, null);
this.setVisible(true);
}
}