I am writing an app that is needs to open dicom imgs(a format for CT images)
when I opened only 1 img I did it by:
opening a jfilechooser and the file I got back was of type win32ShellFolder2
using this file I created an Imageinputstream and read the file.
however now I am trying to open more then 1 file
so I choose a directory from the JFileChooser
get the list of files it contains and open them by
File f = new File(list[i]);
this opens the files as file object which is not good for me
any suggestions on how to open them as win32ShellFolder2
Then you should understand further the JFileChooser API.
I think there is a method their that could solve your problem.
I'm not sure of that. But I have read a book on how to read the files in the directory (not sure about the folders).
getting a file
I have no problem getting a file
however getting all files from folder is the problem
if I want them to fit the type
Well I think u must be able to filter all the files in the directory.
I mean all the files you need.
I have read a code in a book that could read all the files in the directory (not sure about the folders also about the filter). But in that way, you could implement in your code that manner.
I will give you the logic of the code once I visited the school library.
this is stil the easy part
string list = f.getFileList(or something like that)
file = new File(list[i])
openfile(file)//this methode is mine
all I need is the how to open each file and file as a win32shellfolder and not as file
The Win32ShellFolder was replaced with Win32ShellFolder2 after version 1.4.2.
You can make Win32ShellFolder2 objects by instantiating a Win32ShellFolderManager2 object. It has a method called createShellFolder(File) which takes in File objects and returns a corresponding Win32ShellFolder2 objects.
If you are version 1.4.2 or before I believe there was a similar object called Win32ShellFolderManager.