【问题标题】:Upload multiple images in to mysql database in java gui在java gui中将多个图像上传到mysql数据库
【发布时间】:2017-05-14 19:20:13
【问题描述】:

我正在为汽车维修中心做一个项目。在这个项目中,我需要上传损坏车辆的照片,以便员工稍后观看。

JFileChooser chooser = new JFileChooser();
chooser.showOpenDialog(null);
File f = chooser.getSelectedFile();
String filePath = f.getAbsolutePath();
path.setText(filePath);
File imgFile = new File(filePath);

try {
    FileInputStream fin = new FileInputStream(imgFile);

我在上面试过了,但我一次只能选择一张照片,像这样:

我需要这种薄款

dddd

【问题讨论】:

  • 你要一次选择多张图片吗
  • 是的并将它们添加到mysql数据库

标签: java mysql user-interface netbeans


【解决方案1】:

我不使用 java,但快速浏览一下手册表明您需要启用多个文件的选择:

setMultiSelectionEnabled

public void setMultiSelectionEnabled(boolean b)

Sets the file chooser to allow multiple file selections.

Parameters:
    b - true if multiple files may be selected
See Also:
    isMultiSelectionEnabled()

https://docs.oracle.com/javase/8/docs/api/javax/swing/JFileChooser.html#setMultiSelectionEnabled-boolean-

【讨论】:

  • 现在你做了java。
猜你喜欢
  • 2015-01-01
  • 1970-01-01
  • 2013-05-15
  • 1970-01-01
  • 1970-01-01
  • 2012-07-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多