|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjsmooth.Native
public class Native
The Native class is the main hub for accessing the native functions provided by JSmooth at runtime. All the methods provided are static, but it is important that you check the availability of the methods by calling first the isAvailable() method.
When JSmooth loads the JVM, and before calling the application's main class, it registers all the native methods provided in this class with their matching C functions. If the registration process is successful, it enables the binding by setting to true the result of isAvailable().
Field Summary | |
---|---|
static int |
EXITWINDOWS_FORCE
|
static int |
EXITWINDOWS_LOGOFF
|
static int |
EXITWINDOWS_POWEROFF
|
static int |
EXITWINDOWS_REBOOT
|
static int |
EXITWINDOWS_SHUTDOWN
|
static java.lang.String |
SHELLEXECUTE_EDIT
|
static java.lang.String |
SHELLEXECUTE_EXPLORE
|
static java.lang.String |
SHELLEXECUTE_FIND
|
static java.lang.String |
SHELLEXECUTE_OPEN
|
static java.lang.String |
SHELLEXECUTE_PRINT
|
static int |
SW_FORCEMINIMIZE
|
static int |
SW_HIDE
|
static int |
SW_MAX
|
static int |
SW_MAXIMIZE
|
static int |
SW_MINIMIZE
|
static int |
SW_NORMAL
|
static int |
SW_RESTORE
|
static int |
SW_SHOW
|
static int |
SW_SHOWDEFAULT
|
static int |
SW_SHOWMAXIMIZED
|
static int |
SW_SHOWMINIMIZED
|
static int |
SW_SHOWMINNOACTIVE
|
static int |
SW_SHOWNA
|
static int |
SW_SHOWNOACTIVATE
|
static int |
SW_SHOWNORMAL
|
Constructor Summary | |
---|---|
Native()
|
Method Summary | |
---|---|
static boolean |
deleteFileOnReboot(java.lang.String filename)
Flag a file so that Windows shall delete it during the next startup sequence of the operating system. |
static boolean |
exitWindows(int shutdownFlags)
Request Windows to shutdown/reboot the computer, or log off the current user/session. |
static DriveInfo |
getDriveInfo(java.io.File f)
a DriveInfo info object provides platform-specific information relative to the disk volume where the File object parameter is located. |
static java.lang.String |
getExecutableName()
Return the file name of the executable used to launch the current application. |
static java.lang.String |
getExecutablePath()
Return the directory where is located the executable used to launch the current application. |
static boolean |
isAvailable()
Return true if this class is correctly bound to the native methods. |
static boolean |
shellExecute(java.lang.String action,
java.lang.String file,
java.lang.String parameters,
java.lang.String directory,
int showCmd)
Maps the ShellExecute Windows function, which allows the application to either run a new process, or to start a standard operation on any document file, such as opening, editing, printing, etc. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int EXITWINDOWS_FORCE
public static final int EXITWINDOWS_LOGOFF
public static final int EXITWINDOWS_POWEROFF
public static final int EXITWINDOWS_REBOOT
public static final int EXITWINDOWS_SHUTDOWN
public static final java.lang.String SHELLEXECUTE_OPEN
public static final java.lang.String SHELLEXECUTE_PRINT
public static final java.lang.String SHELLEXECUTE_EXPLORE
public static final java.lang.String SHELLEXECUTE_FIND
public static final java.lang.String SHELLEXECUTE_EDIT
public static final int SW_HIDE
public static final int SW_NORMAL
public static final int SW_SHOWNORMAL
public static final int SW_SHOWMINIMIZED
public static final int SW_MAXIMIZE
public static final int SW_SHOWMAXIMIZED
public static final int SW_SHOWNOACTIVATE
public static final int SW_SHOW
public static final int SW_MINIMIZE
public static final int SW_SHOWMINNOACTIVE
public static final int SW_SHOWNA
public static final int SW_RESTORE
public static final int SW_SHOWDEFAULT
public static final int SW_FORCEMINIMIZE
public static final int SW_MAX
Constructor Detail |
---|
public Native()
Method Detail |
---|
public static boolean isAvailable()
public static java.lang.String getExecutablePath()
public static java.lang.String getExecutableName()
public static boolean deleteFileOnReboot(java.lang.String filename)
filename
- the name of the file to deletepublic static boolean exitWindows(int shutdownFlags)
shutdownFlags
- a combination of EXITWINDOWS_* flagspublic static boolean shellExecute(java.lang.String action, java.lang.String file, java.lang.String parameters, java.lang.String directory, int showCmd)
For instance, to start the default application for PDF reading:
shellExecute(Native.SHELLEXECUTE_OPEN, "c:/somewhere/mydocument.pdf", null, null, Native.SW_NORMAL);
To print an html page: shellExecute(Native.SHELLEXECUTE_PRINT, "mydocument.html", null, null, Native.SW_NORMAL);
action
- specify the operation to perform, can be any of the SHELLEXECUTE_* constantfile
- the file to run or for which to start the default applicationparameters
- if file is an executable, this variable specifies the parameters to be passed. Otherwise, just set it to null.directory
- the working directory for the action executed. If set to null, the default working directory of the java application is used.showCmd
- a flag that specifies the state of the launched application display
public static DriveInfo getDriveInfo(java.io.File f)
For instance Native.getDriveInfo(new File("."))
provides a DriveInfo object for the volume on which the current
working directory is located.
Native.getDriveInfo(new File("D:/my/dir/or/file")) is
the same as Native.getDriveInfo(new File("D:")).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |