【发布时间】:2013-03-21 22:58:28
【问题描述】:
我使用JFileChooser 实现了此代码以浏览图像,但问题是我无法实现将图像保存在本地磁盘上的代码。
或者
如果可能的话,我直接想在一个新的JFrame 类中显示这个图像,这将是一个动态链接
private void btnBrowseVideo1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JFileChooser fileChooser = new JFileChooser();
fileChooser.showOpenDialog(null);
mediaUrl = null;
String path = "";
path = fileChooser.getSelectedFile().toString();
path = path.trim();
// System.out.println("URI : "+mediaUrl);
if (path.endsWith(".jpg") || path.endsWith(".JPG")) {
lblBrowseImage.setText(path);
} else {
JOptionPane.showMessageDialog(this, "SELECT .jpg FILE!!!!");
}
}
【问题讨论】:
标签: java image swing netbeans jfilechooser