首页上一页 1 下一页尾页 1 条记录 1/1页
同标题
需要重写组件的绘制方法,例如:
public class Demo extends JFrame {
@Override
public void paint(Graphics g) {
super.paint(g);
try {
BufferedImage image = ImageIO.read(new File("timg.jpg"));
g.drawImage(image, 0, 0, this);
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
Demo f = new Demo();
f.setSize(200, 200);
f.setVisible(true);
}
}