【发布时间】:2013-12-23 21:31:55
【问题描述】:
我想告诉我用户上传后如何将图像保存到 mySQL。
提示:使用 NetBeans GUI Builder
这是我选择图片的代码:
private void btnJFileChooserActionPerformed(java.awt.event.ActionEvent evt) {
JFileChooser fc = new JFileChooser();
int result = fc.showOpenDialog(null);
if (result == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
try {
image2.setIcon(new ImageIcon(ImageIO.read(file)));
} catch (IOException e) {
e.printStackTrace();
}
}
Setter 和 Getter 的捕获:
http://up07.s-oman.net/DVMGa.png
此捕获用于保存按钮:
http://up07.s-oman.net/P2slSGkcj.png
【问题讨论】:
-
在继续之前查看答案to this。