I notice that the File class has a property called folderType, but I cannot see anyway to get this String at run-time. Is there a way? Edit: perhaps it's not part of File.
When I rest my mouse over file in the fileIO.open
I notice that the File class has a property called folderType, but I cannot see anyway to get this String at run-time. Is there a way? Edit: perhaps it's not part of File.
When I rest my mouse over file in the fileIO.open
There are many ways one of them is this MimetypesFileTypeMap().getContentType(file)
and i think fileio is object of class Win32ShellFolder2,this has a public function getFolderType() as mentioned here
so you can use it like this i feel
fileIO.open(file).getFolderType()
The object you have there is a Win32ShellFolder2
, which is a subclass of ShellFolder
, which is a subclass of java.io.File. ShellFolder
defines a getter named getFolderType()
which returns the folder type as a string.
So you could get the contents of the field like this:
file = fileChooser.getSelectedFile();
if (file instanceof ShellFolder) {
ShellFolder sf = (ShellFolder)file;
String folderType = sf.getFolderType();
ShellFolder
and Win32ShellFolder2
are in the package sun.awt.shell
. This package isn't part of the standard Java API, so it could change from one JVM to another or from version of the JVM to another. See With what should I replace sun.awt.shell.ShellFolder so I don't get compile warnings?.