JDirectoryBrowser methods
JDirectoryBrowser methods
createJDirectoryBrowser (
in
String pParentBoxId,
in String pTitle,
in String pPathName);
This creates a JDirectoryBrowser which can browse directories. If the given directory is an empty string, the starting directory for the browser is the desktop directory.
The "pParentBoxId" parameter defines the parent dialog box for which the JDirectoryBrowser is transient.
The "pTitle" parameter defines the title of the directory browser.
The "pPathName" parameter defines the absolute path to the starting point directory.
CSIDL values are also accepted (please refer to MSDN documentation for further details). Accepted values for the CSIDL are as follows:
· CSIDL_ALTSTARTUP;
· CSIDL_APPDATA;
· CSIDL_BITBUCKET;
· CSIDL_COMMON_ALTSTARTUP;
· CSIDL_COMMON_DESKTOPDIRECTORY;
· CSIDL_COMMON_FAVORITES;
· CSIDL_COMMON_PROGRAMS;
· CSIDL_COMMON_STARTMENU;
· CSIDL_COMMON_STARTUP;
· CSIDL_CONTROLS;
· CSIDL_COOKIES;
· CSIDL_DESKTOP;
· CSIDL_DESKTOPDIRECTORY;
· CSIDL_DRIVES;
· CSIDL_FAVORITES;
· CSIDL_FONTS;
· CSIDL_HISTORY;
· CSIDL_INTERNET;
· CSIDL_INTERNET_CACHE;
· CSIDL_NETHOOD;
· CSIDL_NETWORK;
· CSIDL_PERSONAL;
· CSIDL_PRINTERS;
· CSIDL_PRINTHOOD;
· CSIDL_PROGRAMS;
· CSIDL_RECENT;
· CSIDL_SENDTO;
· CSIDL_STARTMENU;
· CSIDL_STARTUP;
· CSIDL_TEMPLATES;
public setTitle (
pTitle in String )
This sets the title of the dialog box.
The "pTitle" parameter defines the title.
public get ()
return String
This is used to display the file browser as a modal dialog box. It returns a string expressing the full path name selected, or O is the dialog box was cancelled. This string must never be deleted or modified.
public getDirectory ()
return String
This returns the directory part of the selected path.
public setDirectory (
pDirectory in String )
This sets the directory which is to be browsed. The "pDirectory" parameter defines the directory.
public setParentBox (
pParentBoxId in String )
This is used to attach the JFileBrowser to the parent dialog box whose identifier is given as a parameter.
The JFileBrowser is then modal and transient for the parent dialog box.
The "pParentBoxId" parameter defines the parent dialog box.
Saying that a view "v1" is transient for a view "v2" means that:
· "v1" cannot be iconified.
· "v1" is automatically unmapped when "v2" is iconified.
· "v1" is always on top of "v2" (in the Windows stacking order).
JDirectoryBrowser example
// First argument corresponds to the id of the
transient view (or "")
// Second argument corresponds to the title of the
directory browser
// Last argument corresponds to the default path.
JDirectoryBrowser
directoryBrowser = createJDirectoryBrowser
("", "Choose a directory", "C:\work\");
// Show the box and display the result in the console
StdOut.write(directoryBrowser.get(), NL);
// Don't forget to destroy the box
directoryBrowser.delete();