• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Select only Directories in AWT FileDialog

 
Rajesh Kumar
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.
i have a strange problem.
In Swings we have a method called setFileSelectionMode like....
setFileSelectionMode(jFileChooser_fc.DIRECTORIES_ONLY);
with that we can select either directories, or files, or both.
is there anything like that in AWT to select only Directories.
i have a awt application
in that applicn in file dialog i have to select only directories.
in that files should not be appeared. only directories should appear
pl help me
thanksinadvance
yours
Rajesh
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajesh,
IMO I don't think that this is possible because AWT just uses the OS common dialog. Windows requires a fileName to be specified before it will even close with the OK button. Since that is the case, AWT couldn't even change it if it wanted to.
Swing can do it because the entire JFileChooser is inside the JVM so it has total control over its functionality. That is why Swing was developed in the first place.
Regards,
Manfred.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!