Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jsmooth
Class Native

    java.lang.Object
      jsmooth.Native

    public class Native

extends java.lang.Object

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

### EXITWINDOWS_FORCE

    public static final int EXITWINDOWS_FORCE

See Also:
  Constant Field Values

### EXITWINDOWS_LOGOFF

    public static final int EXITWINDOWS_LOGOFF

See Also:
  Constant Field Values

### EXITWINDOWS_POWEROFF

    public static final int EXITWINDOWS_POWEROFF

See Also:
  Constant Field Values

### EXITWINDOWS_REBOOT

    public static final int EXITWINDOWS_REBOOT

See Also:
  Constant Field Values

### EXITWINDOWS_SHUTDOWN

    public static final int EXITWINDOWS_SHUTDOWN

See Also:
  Constant Field Values

### SHELLEXECUTE_OPEN

    public static final java.lang.String SHELLEXECUTE_OPEN

See Also:
  Constant Field Values

### SHELLEXECUTE_PRINT

    public static final java.lang.String SHELLEXECUTE_PRINT

See Also:
  Constant Field Values

### SHELLEXECUTE_EXPLORE

    public static final java.lang.String SHELLEXECUTE_EXPLORE

See Also:
  Constant Field Values

### SHELLEXECUTE_FIND

    public static final java.lang.String SHELLEXECUTE_FIND

See Also:
  Constant Field Values

### SHELLEXECUTE_EDIT

    public static final java.lang.String SHELLEXECUTE_EDIT

See Also:
  Constant Field Values

### SW_HIDE

    public static final int SW_HIDE

See Also:
  Constant Field Values

### SW_NORMAL

    public static final int SW_NORMAL

See Also:
  Constant Field Values

### SW_SHOWNORMAL

    public static final int SW_SHOWNORMAL

See Also:
  Constant Field Values

### SW_SHOWMINIMIZED

    public static final int SW_SHOWMINIMIZED

See Also:
  Constant Field Values

### SW_MAXIMIZE

    public static final int SW_MAXIMIZE

See Also:
  Constant Field Values

### SW_SHOWMAXIMIZED

    public static final int SW_SHOWMAXIMIZED

See Also:
  Constant Field Values

### SW_SHOWNOACTIVATE

    public static final int SW_SHOWNOACTIVATE

See Also:
  Constant Field Values

### SW_SHOW

    public static final int SW_SHOW

See Also:
  Constant Field Values

### SW_MINIMIZE

    public static final int SW_MINIMIZE

See Also:
  Constant Field Values

### SW_SHOWMINNOACTIVE

    public static final int SW_SHOWMINNOACTIVE

See Also:
  Constant Field Values

### SW_SHOWNA

    public static final int SW_SHOWNA

See Also:
  Constant Field Values

### SW_RESTORE

    public static final int SW_RESTORE

See Also:
  Constant Field Values

### SW_SHOWDEFAULT

    public static final int SW_SHOWDEFAULT

See Also:
  Constant Field Values

### SW_FORCEMINIMIZE

    public static final int SW_FORCEMINIMIZE

See Also:
  Constant Field Values

### SW_MAX

    public static final int SW_MAX

See Also:
  Constant Field Values

Constructor Detail

### Native

    public Native()

Method Detail

### isAvailable

    public static boolean isAvailable()

  Return true if this class is correctly bound to the native methods.

  Returns:
    true if you can use this class, false otherwise.

### getExecutablePath

    public static java.lang.String getExecutablePath()

  Return the directory where is located the executable used to launch the current application. The result is a string containing a native file descriptor of the directory.
  For instance: `c:\my program\here\`

  Returns:
    A java.lang.String containing the path of this executable

### getExecutableName

    public static java.lang.String getExecutableName()

  Return the file name of the executable used to launch the current application. It only contains the file part, not the directory.
  For instance: `myprogram.exe`

  Returns:
    A java.lang.String containing the name of this executable

### deleteFileOnReboot

    public 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. The file is not deleted nor touched before the next reboot. If the file is already deleted, nothing happens.

  Parameters:
    `filename` - the name of the file to delete

### exitWindows

    public static boolean exitWindows(int shutdownFlags)

  Request Windows to shutdown/reboot the computer, or log off the current user/session. There is no dialog asking the user to confirm.

  Parameters:
    `shutdownFlags` - a combination of EXITWINDOWS_* flags

### shellExecute

    public 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.

  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);`

  Parameters:
    `action` - specify the operation to perform, can be any of the SHELLEXECUTE_* constant
    `file` - the file to run or for which to start the default application
    `parameters` - 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
  Returns:
    true if the action was successfully started, false if an error occurred.

### getDriveInfo

    public 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. This method determines the disk drive from the File object provided, or from the disk drive of the working directory if the File object does not represent an absolute path.

  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:"))`.

  Returns:
    an DriveInfo object

Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD