为什么java中的某些类不能引用

moming1919 2004-03-17 10:08:25
我在使用JFileChooser类的addChoosableFileFilter(),setFileFilter()方法时提示不能在此处使用,在使用PreparedStatement的setBinaryStream()方法时也出现类似问题!
...全文
129 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
moming1919 2004-03-18
  • 打赏
  • 举报
回复
不应该呀,如果过时使用的时候都有提示的,而且不是一般都向下兼容吗
chrisjen 2004-03-18
  • 打赏
  • 举报
回复
有些方法,是过时了的 :)
moming1919 2004-03-18
  • 打赏
  • 举报
回复
能给我一个例子吗,我看一看与我的有什么不同
pstm=con.prepareStatement("insert into doc values(?,?,?)");
pstm.setString(1,fileName);
pstm.setString(2,fileType);
pstm.setBinaryStream(3,fin,fileLength);
fin为FileInputStream
写的很简单的,应该没错误呀
CoolAbu 2004-03-18
  • 打赏
  • 举报
回复
setBinaryStream方法要带参数的,我用过很多次了,没有什么问题的。


setBinaryStream(int parameterIndex, InputStream x, int length)
Sets the designated parameter to the given input stream, which will have the specified number of bytes.
moming1919 2004-03-18
  • 打赏
  • 举报
回复
JFileChooser的问题已经解决,是我写的myFileFilter类继承错误,但PreparedStatement的setBinaryStream()方法使用仍然出错,提示为,setBinaryStream() cannot be applied at line **
kkcncry 2004-03-17
  • 打赏
  • 举报
回复
把错误提示写在上面啊~~
moming1919 2004-03-17
  • 打赏
  • 举报
回复
我的程序如下
JFileChooser jfc=new JFileChooser();
jfc.addChoosableFileFilter(new myFileFilter());
仅此就出错;
myFileFilter extends FileFilter
hesi726 2004-03-17
  • 打赏
  • 举报
回复
如下所示,
addChoosableFileFilter(new FileFilter(){
public boolean accept(File f) { return true; }
public String description() { return ""; }
}
);

hesi726 2004-03-17
  • 打赏
  • 举报
回复
addChoosableFileFilter(),setFileFilter() 里面都要带一个 FileFilter 类,但 记住,
FileFilter 是抽象类,所以你不能创建该类的实例啊!!
mvmouse 2004-03-17
  • 打赏
  • 举报
回复
说详细些好吗

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧