• Post Reply Bookmark Topic Watch Topic
  • New Topic

JFileChooser Problems

 
MIRANGA_H
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey...
I have a DataField and a Button. And, i have connected a JFileChooser to the button and when it clicks the file chooser opens. But, i want it to show only a limited set of file types !!! HOW DO I DO IT ???
Also, when i hav chosen a particular file, i want the name of the file withe extension to appear in the earlier said DataField.... HOW TO DO THAT ???
 
Jared Cope
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Last I looked there was a bug in the JDK that didn't allow filters to work properly with the standard file chooser that ships with the JDK. So even though you specify the filter list, it never applied for me.

I think there are third party file choosers that work though. Have a look on google.

Cheers, Jared.
 
MIRANGA_H
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey can u give the code fot it pls ???
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JCoder Applications

Welcome to Javaranch! We don't have too many rules around here but we do have a Naming Policy. Please read the policy and adjust your display name accordingly. You can adjust you display name by clicking on the My Profile link.

Thanks.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jared Cope:
Hi,

Last I looked there was a bug in the JDK that didn't allow filters to work properly with the standard file chooser that ships with the JDK. So even though you specify the filter list, it never applied for me.

I think there are third party file choosers that work though. Have a look on google.

Cheers, Jared.


I've never heard of a bug before. I use Filters for my File Choosers all the time. And there is some really good documentation and code here on how to create filters.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!