这是我的应用程序:首先,我们必须上传一张图片,然后当我们点击搜索 ..JLabel
在应用程序上将显示从创建的图标new File("gambar/HistoJPG/sample.jpeg")
。
单击重置按钮时,图像和图像sample.jpeg
将被删除。
但是当我上传下一张图片时,新的sample.jpg
将再次创建并显示。但是应用程序仍然显示旧的sample.jpg
,而不是新的,即使旧的sample.jpg
已被删除。
这是我的一些代码
histoQ.setIcon(new ImageIcon("gambar/HistoJPG/sample.jpeg"));
这是按钮重置操作:
breset.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
imgLabel.setIcon(new ImageIcon("src/image/blank.jpg"));
File fildel = new File("gambar/HistoJPG/sample.jpeg");
fildel.delete();
}
}