为什么我上传图片传到某个文件夹下不刷新不出来啊 为什么我上传图片传到某个文件夹下不刷新的话图片不出来。程序读不出来这个图片,刷新下那个文件夹就好了,怎么解决啊,请高手帮帮忙 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void initGUI() { try { this.setPreferredSize(new java.awt.Dimension(581, 410)); { jPanel1 = new JPanel(); this.add(jPanel1); jPanel1.setPreferredSize(new java.awt.Dimension(584, 407)); jPanel1.setLayout(null); { jFileChooser1 = new JFileChooser(); jPanel1.add(jFileChooser1); jFileChooser1.setMultiSelectionEnabled(false); int returnVal = jFileChooser1.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { f = new File(jFileChooser1.getSelectedFile() .getAbsolutePath()); if (f != null) { if (jFileChooser1.getSelectedFile() .getAbsolutePath().endsWith("jpg")) { FileInputStream ss = new FileInputStream(f); BufferedInputStream sss=new BufferedInputStream(ss); byte[] b = new byte[sss.available()]; sss.read(b); sss.close(); ss.close(); int returnVa = jFileChooser1 .showSaveDialog(this); if (returnVa == JFileChooser.APPROVE_OPTION) { String s = "src/picture/" + jFileChooser1.getSelectedFile() .getName(); FileOutputStream o = new FileOutputStream(s); BufferedOutputStream oo=new BufferedOutputStream(o); oo.write(b); oo.close(); o.close(); String t=s; mai.getContentPane().removeAll(); mai.dispose(); new DishInFrame(main,t).show(true); } if (returnVa == jFileChooser1.CANCEL_OPTION) { mai.getContentPane().removeAll(); mai.getContentPane().add(new DishPicturePanel(mai)); mai.getContentPane().validate(); } }else { JOptionPane.showMessageDialog(this, "图片必须是jpg格式的"); mai.getContentPane().removeAll(); mai.dispose(); new DishInFrame(main).show(true); } } } if (returnVal == jFileChooser1.CANCEL_OPTION) { mai.getContentPane().removeAll(); mai.dispose(); new DishInFrame(main).show(true); } jFileChooser1.setBounds(0, -6, 584, 413); } } } catch (Exception e) { e.printStackTrace(); } } 请教!如何获得response header的内容??? java的多继承问题 帮帮忙! 怎么给JPanel 加上 JScrollPane!!!! replaceAll 使用 log4j 是否可以输出到excel中,有没有什么的appender 怎样添加背景音乐? 如何将JAVA程序发布? 如何建立一个圆形按钮,当单击它时,在右边的PANEL中画出一个圆,并且这个圆可以移动和改变大小? applet中jdbc报错,那位大虾来帮忙? 怎样弹出一个对话框 android运行的问题 关于网络编程
try {
this.setPreferredSize(new java.awt.Dimension(581, 410));
{
jPanel1 = new JPanel();
this.add(jPanel1);
jPanel1.setPreferredSize(new java.awt.Dimension(584, 407));
jPanel1.setLayout(null);
{
jFileChooser1 = new JFileChooser();
jPanel1.add(jFileChooser1);
jFileChooser1.setMultiSelectionEnabled(false);
int returnVal = jFileChooser1.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) { f = new File(jFileChooser1.getSelectedFile()
.getAbsolutePath());
if (f != null) {
if (jFileChooser1.getSelectedFile()
.getAbsolutePath().endsWith("jpg")) { FileInputStream ss = new FileInputStream(f);
BufferedInputStream sss=new BufferedInputStream(ss);
byte[] b = new byte[sss.available()];
sss.read(b);
sss.close();
ss.close();
int returnVa = jFileChooser1
.showSaveDialog(this);
if (returnVa == JFileChooser.APPROVE_OPTION) { String s = "src/picture/"
+ jFileChooser1.getSelectedFile()
.getName();
FileOutputStream o = new FileOutputStream(s);
BufferedOutputStream oo=new BufferedOutputStream(o);
oo.write(b);
oo.close();
o.close();
String t=s;
mai.getContentPane().removeAll();
mai.dispose();
new DishInFrame(main,t).show(true);
}
if (returnVa == jFileChooser1.CANCEL_OPTION) {
mai.getContentPane().removeAll();
mai.getContentPane().add(new DishPicturePanel(mai));
mai.getContentPane().validate();
} }else {
JOptionPane.showMessageDialog(this, "图片必须是jpg格式的");
mai.getContentPane().removeAll();
mai.dispose();
new DishInFrame(main).show(true);
}
}
}
if (returnVal == jFileChooser1.CANCEL_OPTION) {
mai.getContentPane().removeAll();
mai.dispose();
new DishInFrame(main).show(true); }
jFileChooser1.setBounds(0, -6, 584, 413);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}