HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML
 

"A Windows-Specific Java Utility Class"
Volume: 4 Issue: 6, p. 82

Download files assoicated with this article

	

Listing 1. 

import java.awt.*; 
import java.util.*; 
import java.io.*; 

/** 
 * A Windows®-specific Java utility class. 
 * 
 * @author Pat Paternostro, Tri-Com Consulting Group L.L.C. 
 * @version 1.0 
 */ 
public final class JUtil 
{ 
 /** 
  * The drive type cannot be determined. 
  */ 
 public static final int DRIVE_UNKNOWN = 0; 
  
 /** 
  * The root directory does not exist. 
  */ 
 public static final int DRIVE_NO_ROOT_DIR = 1; 
  
 /** 
  * The disk can be removed from the drive. 
  */ 
 public static final int DRIVE_REMOVABLE = 2; 
  
 /** 
  * The disk cannot be removed from the drive. 
  */ 
 public static final int DRIVE_FIXED = 3; 
  
 /** 
  * The drive is a remote (network) drive. 
  */ 
 public static final int DRIVE_REMOTE = 4; 
  
 /** 
  * The drive is a CD-ROM drive. 
  */ 
 public static final int DRIVE_CDROM = 5; 
  
 /** 
  * The drive is a RAM disk. 
  */ 
 public static final int DRIVE_RAMDISK = 6; 
  

 static 
 { 
  System.loadLibrary("JUtil"); 
 } 
  
 /* Make the constructor private so the class cannot be instantiated */ 
 private JUtil() {} 
  
 /** 
  * Retrieves the character typed at the command console. 
  * 
  * @return the character typed at the command console 
  */ 
 public static native char getConsoleChar(); 
  
 /** 
  * Retrieves the system's logical drives. 
  * 
  * @return an array of <CODE>String</CODE> objects that contains the logical 
  * drive names in the form of <CODE><B>x:\</B></CODE> 
  where <CODE><B>x</B></CODE> denotes the drive letter 
  */ 
 public static native String[] getLogicalDrives(); 
  
 /** 
  * Retrieves the specified drive's free disk space. 
  * 
  * @param <CODE>drive</CODE> a <CODE>String</CODE> that specifies the root directory 
  * of the disk to return free disk space information about. 
  If <CODE>drive</CODE> is 
  * <CODE>null</CODE> the method uses the root of the current directory. 
  * @return the free disk space in bytes 
  * @see #getLogicalDrives 
  */ 
 public static native long getFreeDiskSpace(String drive); 
  
 /** 
  * Retrieves the specified drive's type. 
  * 
  * @param <CODE>drive</CODE> a <CODE>String</CODE> that specifies the root directory 
  * of the disk to return the drive type information about. If <CODE>drive</CODE> is 
  * <CODE>null</CODE> the method uses the root of the current directory. 
  * @return an <CODE>int</CODE> that specifies the drive type 
  * @see #getLogicalDrives 
  * @see #DRIVE_UNKNOWN 
  * @see #DRIVE_NO_ROOT_DIR 
  * @see #DRIVE_REMOVABLE 
  * @see #DRIVE_FIXED 
  * @see #DRIVE_REMOTE 
  * @see #DRIVE_CDROM 
  * @see #DRIVE_RAMDISK 
  */ 
 public static native int getDriveType(String drive); 
  
 /** 
  * Retrieves the specified volume's label. 
  * 
  * @param <CODE>drive</CODE> a <CODE>String</CODE> 
  that specifies the root directory 
  * of the disk to return the volume label. If <CODE>drive</CODE> is 
  * <CODE>null</CODE> the method uses the root of the current directory. 
  * @return a <CODE>String</CODE> containing the specified volume's label 
  * @see #getLogicalDrives 
  */ 
 public static native String getVolumeLabel(String drive); 
  
 /** 
  * Sets the specified volume's label. 
  * 
  * @param <CODE>drive</CODE> a <CODE>String</CODE> that specifies the root directory 
  * of the disk to set the volume label. If <CODE>drive</CODE> is 
  * <CODE>null</CODE> the method uses the root of the current directory. 
  * @param <CODE>label</CODE> a <CODE>String</CODE> that represents the volume's label name. 
The maximum number of characters for a volume label is 11. If <CODE>label</CODE> 
is more that 11 characters 
  * long the volume's label will not be set. If <CODE>label</CODE> 
  is <CODE>null</CODE> the specified volume's 
  * label is deleted. 
  * @return a <CODE>boolean</CODE> specifying whether the volume's label was set. <CODE><B>true</B></CODE> 
  * if the volume's label was set, <CODE><B>false</B></CODE> otherwise. 
  * @see #getLogicalDrives 
  */ 
 public static native boolean setVolumeLabel(String drive, String label); 
  
 /** 
  * Retrieves the current directory. 
  * 
  * @return a <CODE>String</CODE> representing the current directory 
  */ 
 public static native String getCurrentDirectory(); 
  
 /** 
  * Sets the current directory. 
  * 
  * @param <CODE>directory</CODE> a <CODE>String</CODE> that specifies the current directory to set 
  * @return a <CODE>boolean</CODE> indicating if the current directory was set. <CODE><B>true</B></CODE> 
  * if the current directory was set, <CODE><B>false</B></CODE> otherwise. 
  */ 
 public static native boolean setCurrentDirectory(String directory); 
  
 /** 
  * Retrieves the Win32® window handle for the specified window title. 
  * 
  * @param <CODE>title</CODE> the title of the window whose Win32® window handle to retrieve 
  * @return an <CODE>int</CODE> representing the Win32® window handle for the specified window title 
  */ 
 public static native int getHwnd(String title); 

 /** 
  * Minimizes the specified window. 
  * 
  * @param <CODE>hwnd</CODE> the window's Win32® handle 
  * @see #getHwnd 
  */ 
 public static native void setWindowMinimized(int hwnd); 
  
 /** 
  * Maximizes the specified window. 
  * 
  * @param <CODE>hwnd</CODE> the window's Win32® handle 
  * @see #getHwnd 
  */ 
 public static native void setWindowMaximized(int hwnd); 
  
 /** 
  * Restores the specified window. 
  * 
  * @param <CODE>hwnd</CODE> the window's Win32® handle 
  * @see #getHwnd 
  */ 
 public static native void setWindowRestored(int hwnd); 
  
 /** 
  * Enables/disables the specified window's <CODE><B>Restore</B></CODE> button. 
  * 
  * @param <CODE>hwnd</CODE> the window's Win32® handle 
  * @param <CODE>flag</CODE> a <CODE>boolean</CODE> parameter that specifies whether to enable or disable 
  * the window's <CODE><B>Restore</B></CODE> button. <CODE><B>true</B></CODE> enables the button, 
  * <CODE><B>false</B></CODE> disables the button. 
  * @see #getHwnd 
  */ 
 public static native void setWindowRestoreEnabled(int hwnd, boolean flag); 
  
 /** 
  * Enables/disables the specified window's <CODE><B>Move</B></CODE> system menu item. 
  * 
  * @param <CODE>hwnd</CODE> the window's Win32® handle 
  * @param <CODE>flag</CODE> a <CODE>boolean</CODE> parameter that specifies whether to enable or disable 
  * the window's <CODE><B>Move</B></CODE> system menu item. <CODE><B>true</B></CODE> enables the menu item, 
  * <CODE><B>false</B></CODE> disables the menu item. 
  * @see #getHwnd 
  */ 
 public static native void setWindowMoveEnabled(int hwnd, boolean flag); 
  
 /** 
  * Enables/disables the specified window's <CODE><B>Size</B></CODE> system menu item. 
  * 
  * @param <CODE>hwnd</CODE> the window's Win32® handle 
  * @param <CODE>flag</CODE> a <CODE>boolean</CODE> parameter that specifies whether to enable or disable 
  * the window's <CODE><B>Size</B></CODE> system menu item. <CODE><B>true</B></CODE> enables the menu item, 
  * <CODE><B>false</B></CODE> disables the menu item. 
  * @see #getHwnd 
  */ 
 public static native void setWindowSizeEnabled(int hwnd, boolean flag); 
  
 /** 
  * Enables/disables the specified window's <CODE><B>Minimize</B></CODE> button. 
  * 
  * @param <CODE>hwnd</CODE> the window's Win32® handle 
  * @param <CODE>flag</CODE> a <CODE>boolean</CODE> parameter that specifies whether to enable or disable 
  * the window's <CODE><B>Minimize</B></CODE> button. <CODE><B>true</B></CODE> enables the button, 
  * <CODE><B>false</B></CODE> disables the button. 
  * @see #getHwnd 
  */ 
 public static native void setWindowMinimizeEnabled(int hwnd, boolean flag); 
  
 /** 
  * Enables/disables the specified window's <CODE><B>Maximize</B></CODE> button. 
  * 
  * @param <CODE>hwnd</CODE> the window's Win32® handle 
  * @param <CODE>flag</CODE> a <CODE>boolean</CODE> parameter that specifies whether to enable or disable 
  * the window's <CODE><B>Maximize</B></CODE> button. <CODE><B>true</B></CODE> enables the button, 
  * <CODE><B>false</B></CODE> disables the button. 
  * @see #getHwnd 
  */ 
 public static native void setWindowMaximizeEnabled(int hwnd, boolean flag); 
  
 /** 
  * Sets the specified window as the topmost window in the z-order. 
  * 
  * @param <CODE>hwnd</CODE> the window's Win32® handle 
  * @param <CODE>flag</CODE> a <CODE>boolean</CODE> parameter that specifies whether 
  * the window will be the topmost window in the z-order. <CODE><B>true</B></CODE> sets the window as 
  * the topmost window in the z-order, <CODE><B>false</B></CODE> sets the window behind all topmost windows. 
  * @see #getHwnd 
  */ 
 public static native void setWindowAlwaysOnTop(int hwnd, boolean flag); 
  
 /** 
  * Sets the specified container's components to the specified font. 
  * 
  * @param <CODE>cont</CODE> the <CODE>Container</CODE> whose components will be set with the specified font 
  * @param <CODE>f</CODE> the <CODE>Font</CODE> object that will be used 
  * @see java.awt.Container 
  * @see java.awt.Font 
  * @exception IllegalArgumentException if <CODE>cont</CODE> or <CODE>f</CODE> are <CODE>null</CODE> 
  */ 
 public static void setContainerDefaultFont(Container cont, Font f) throws IllegalArgumentException 
 { 
  /* Check for illegal arguments */ 
  if (cont == null || f == null) 
   throw new IllegalArgumentException("This method cannot accept null arguments!"); 
  
  /* Get the container's components */ 
  Component[] comp = cont.getComponents(); 
  
  /* Cycle through the components and set the font */ 
  for (int i = 0; i < comp.length; i++) 
   comp[i].setFont(f); 
 } 

 /** 
  * Sets the specified menubar's menus and menu items to the specified font. 
  * 
  * @param <CODE>mb</CODE> the <CODE>MenuBar</CODE> whose menus and menu items will be set with the specified font 
  * @param <CODE>f</CODE> the <CODE>Font</CODE> object that will be used 
  * @see java.awt.MenuBar 
  * @see java.awt.Font 
  * @exception IllegalArgumentException if <CODE>mb</CODE> or <CODE>f</CODE> are <CODE>null</CODE> 
  */ 
 public static void setMenuBarDefaultFont(MenuBar mb, Font f) throws IllegalArgumentException 
 { 
  int menuCount = 0, menuItemCount = 0; 

  /* Check for legal arguments */ 
  if (mb == null || f == null) 
   throw new IllegalArgumentException("This method cannot accept null arguments!"); 

  /* Get the menubar's menu count */ 
  menuCount = mb.getMenuCount(); 
  
  /* Cycle through the menus */ 
  for (int i = 0; i < menuCount; i++) 
  { 
   /* Set the menu's font */ 
   mb.getMenu(i).setFont(f); 
  
   /* Get the menu's menu item count */ 
   menuItemCount = mb.getMenu(i).getItemCount(); 
  
   /* Cycle through the menu items and set the font */ 
   for (int j = 0; j < menuItemCount; j++) 
    mb.getMenu(i).getItem(j).setFont(f); 
  } 
 } 

 /** 
  * Copies the specified source file to the specified destination file. 
  * 
  * @param <CODE>source</CODE> the source file name 
  * @param <CODE>dest</CODE> the destination file name 
  * @exception IllegalArgumentException if the <CODE>source</CODE> or <CODE>dest</CODE> file names are null or empty 
  * @exception FileNotFoundException if the source file name does not exist 
  * @exception IOException if a problem was encountered reading from the source file or writing to the destination file 
  */ 
 public static void copyFile(String source, String dest) throws IllegalArgumentException, FileNotFoundException, IOException 
 { 
  FileWriter fw = null; 
  FileReader fr = null; 
  BufferedReader br = null; 
  BufferedWriter bw = null; 
  File fileSource = null; 

  /* Check for illegal arguments */ 
  if ((source == null || source.equals("")) || ((dest == null) || dest.equals(""))) 
   throw new IllegalArgumentException("This method cannot accept null or empty (\"\") String arguments!"); 

  try 
  { 
   fr = new FileReader(source); 
   fw = new FileWriter(dest); 
   br = new BufferedReader(fr); 
   bw = new BufferedWriter(fw); 

   /* Determine the size of the buffer to allocate */ 
   fileSource = new File(source); 

   /* Array length must be an int so cast the source file's length */ 
   int fileLength = (int) fileSource.length(); 

   char charBuff[] = new char[fileLength]; 

   while (br.read(charBuff,0,fileLength) != -1) 
    bw.write(charBuff,0,fileLength); 
  } 
  finally 
  { 
   try 
   { 
    if (br != null) 
     br.close(); 
    if (bw != null) 
     bw.close(); 
   } 
   catch(IOException ioe){} 
  } 
 } 
} 
  

Listing 2. 

#include "JUtil.h" 
#define STRICT 
#include <windows.h> 
#include <conio.h> 
  

JNIEXPORT jchar JNICALL Java_JUtil_getConsoleChar(JNIEnv *env, jclass obj) 
{ 
 return _getch(); 
} 

JNIEXPORT jobjectArray JNICALL Java_JUtil_getLogicalDrives(JNIEnv *env, jclass obj) 
{ 
 DWORD dStrLength; 
 char szDrives[256]; 
 jobjectArray strArray = NULL; 

 memset(szDrives,'\0',sizeof(szDrives)); 
 dStrLength = GetLogicalDriveStrings(sizeof(szDrives),szDrives); 

 /* 
 ** The length of the array is returned from the above function minus the 
 ** terminating null character. The function will place the names of the 
 ** logical drives in the passed character array and null separate the names. 
 ** The names will be in the form of X:\ where X denotes the drive letter. 
 ** Therefore the length returned can be divided by 4 (the total number of 
 ** characters in each name plus the null separator) to determine the number 
 ** of drives returned from the function. This number is then used to allocate 
 ** storage for the array of Strings that will passed back to the caller of this 
 ** function. 
 */ 
 if (dStrLength) 
 { 
  int i, nDriveCount, nOffset = 0; 

  nDriveCount = dStrLength/4; 

  /* Allocate storage for Java array of String objects */ 
  strArray = (*env)->NewObjectArray(env,nDriveCount,(*env)->FindClass(env,"java/lang/String"),(*env)->NewStringUTF(env, "")); 

  /* Cycle through the string to get the names of the logical drives */ 
  for (i = 0; i < nDriveCount; i++) 
  { 
   /* Add the logical drive name as a Java String to the Java object array */ 
   (*env)->SetObjectArrayElement(env, strArray, i, (*env)->NewStringUTF(env, szDrives)); 

   /* Advance to the next logical drive name */ 
   szDrives[0] = szDrives[nOffset += 4]; 
  } 
 } 

 return strArray; 
} 

JNIEXPORT jlong JNICALL Java_JUtil_getFreeDiskSpace(JNIEnv *env, jclass obj, jstring drive) 
{ 
 DWORD sectorsPerCluster = 0, bytesPerSector = 0; 
 DWORD freeClusters = 0, totalClusters = 0, freeBytes = 0; 
 BOOL fReturn; 
 const char *str = NULL; 

 str = (*env)->GetStringUTFChars(env, drive, 0); 
 fReturn = GetDiskFreeSpace(str,§orsPerCluster,&bytesPerSector,&freeClusters,&totalClusters); 
 (*env)->ReleaseStringUTFChars(env, drive, str); 

 if (fReturn) 
  freeBytes = freeClusters * sectorsPerCluster * bytesPerSector; 

 return freeBytes; 
} 

JNIEXPORT jint JNICALL Java_JUtil_getDriveType(JNIEnv *env, jclass obj, jstring drive) 
{ 
 const char *str = NULL; 
 UINT uReturn; 

 str = (*env)->GetStringUTFChars(env, drive, 0); 
 uReturn = GetDriveType(str); 
 (*env)->ReleaseStringUTFChars(env, drive, str); 

 return uReturn; 
} 

JNIEXPORT jstring JNICALL Java_JUtil_getVolumeLabel(JNIEnv *env, jclass obj, jstring drive) 
{ 
 char szVolumeName[256]; 
 const char *str = NULL; 
 DWORD maxCompLen = 0, fileSystemFlags = 0; 

 memset(szVolumeName,'\0',sizeof(szVolumeName)); 
 str = (*env)->GetStringUTFChars(env, drive, 0); 
 GetVolumeInformation(str,szVolumeName,sizeof(szVolumeName),NULL,&maxCompLen,&fileSystemFlags,NULL,0); 
 (*env)->ReleaseStringUTFChars(env, drive, str); 

 return (*env)->NewStringUTF(env,szVolumeName); 
} 

JNIEXPORT jboolean JNICALL Java_JUtil_setVolumeLabel(JNIEnv *env, jclass obj, jstring drive, jstring label) 
{ 
 BOOL fReturn; 
 const char *str1 = NULL, *str2 = NULL; 

 str1 = (*env)->GetStringUTFChars(env, drive, 0); 
 str2 = (*env)->GetStringUTFChars(env, label, 0); 
 fReturn = SetVolumeLabel(str1,str2); 
 (*env)->ReleaseStringUTFChars(env, drive, str1); 
 (*env)->ReleaseStringUTFChars(env, label, str2); 

 return fReturn; 
} 

JNIEXPORT jstring JNICALL Java_JUtil_getCurrentDirectory(JNIEnv *env, jclass obj) 
{ 
 char szCurrentDir[_MAX_PATH]; 

 memset(szCurrentDir,'\0',sizeof(szCurrentDir)); 
 GetCurrentDirectory(_MAX_PATH,szCurrentDir); 

 return (*env)->NewStringUTF(env, szCurrentDir); 
} 

JNIEXPORT jboolean JNICALL Java_JUtil_setCurrentDirectory(JNIEnv *env, jclass obj, jstring directory) 
{ 
 BOOL fReturn; 
 const char *str = NULL; 
  
 str = (*env)->GetStringUTFChars(env, directory, 0); 
 fReturn = SetCurrentDirectory(str); 
 (*env)->ReleaseStringUTFChars(env, directory, str); 

 return fReturn; 
} 

JNIEXPORT jint JNICALL Java_JUtil_getHwnd(JNIEnv *env, jclass obj, jstring title) 
{ 
 HWND hwnd = NULL; 
 const char *str = NULL; 

 str = (*env)->GetStringUTFChars(env, title, 0); 
 hwnd = FindWindow(NULL,str); 
 (*env)->ReleaseStringUTFChars(env, title, str); 

 return (jint) hwnd; 
} 

JNIEXPORT void JNICALL Java_JUtil_setWindowMinimized(JNIEnv *env, jclass obj, jint hwnd) 
{ 
 SendMessage((HWND) hwnd,WM_SYSCOMMAND,SC_MINIMIZE,0L); 

 return; 
} 

JNIEXPORT void JNICALL Java_JUtil_setWindowMaximized(JNIEnv *env, jclass obj, jint hwnd) 
{ 
 SendMessage((HWND) hwnd,WM_SYSCOMMAND,SC_MAXIMIZE,0L); 

 return; 
} 

JNIEXPORT void JNICALL Java_JUtil_setWindowRestored(JNIEnv *env, jclass obj, jint hwnd) 
{ 
 SendMessage((HWND) hwnd,WM_SYSCOMMAND,SC_RESTORE,0L); 

 return; 
} 

JNIEXPORT void JNICALL Java_JUtil_setWindowRestoreEnabled(JNIEnv *env, jclass obj, jint hwnd, jboolean flag) 
{ 
 HMENU hSysMenu = NULL; 

 hSysMenu = GetSystemMenu((HWND) hwnd,FALSE); 

 if (!flag) 
  ModifyMenu(hSysMenu,0,MF_BYPOSITION|MF_GRAYED|MF_STRING,0,"&Restore"); 
 else 
  ModifyMenu(hSysMenu,0,MF_BYPOSITION|MF_ENABLED|MF_STRING,0,"&Restore"); 

 return; 
} 

JNIEXPORT void JNICALL Java_JUtil_setWindowMoveEnabled(JNIEnv *env, jclass obj, jint hwnd, jboolean flag) 
{ 
 HMENU hSysMenu = NULL; 

 hSysMenu = GetSystemMenu((HWND) hwnd,FALSE); 

 if (!flag) 
  ModifyMenu(hSysMenu,1,MF_BYPOSITION|MF_GRAYED|MF_STRING,0,"&Move"); 
 else 
  ModifyMenu(hSysMenu,1,MF_BYPOSITION|MF_ENABLED|MF_STRING,0,"&Move"); 

 return; 
} 

JNIEXPORT void JNICALL Java_JUtil_setWindowSizeEnabled(JNIEnv *env, jclass obj, jint hwnd, jboolean flag) 
{ 
 HMENU hSysMenu = NULL; 

 hSysMenu = GetSystemMenu((HWND) hwnd,FALSE); 

 if (!flag) 
  ModifyMenu(hSysMenu,2,MF_BYPOSITION|MF_GRAYED|MF_STRING,0,"&Size"); 
 else 
  ModifyMenu(hSysMenu,2,MF_BYPOSITION|MF_ENABLED|MF_STRING,0,"&Size"); 

 return; 
} 

JNIEXPORT void JNICALL Java_JUtil_setWindowMinimizeEnabled(JNIEnv *env, jclass obj, jint hwnd, jboolean flag) 
{ 
 HMENU hSysMenu = NULL; 

 hSysMenu = GetSystemMenu((HWND) hwnd,FALSE); 

 if (!flag) 
  ModifyMenu(hSysMenu,3,MF_BYPOSITION|MF_GRAYED|MF_STRING,0,"Mi&nimize"); 
 else 
  ModifyMenu(hSysMenu,3,MF_BYPOSITION|MF_ENABLED|MF_STRING,0,"Mi&nimize"); 

 return; 
} 

JNIEXPORT void JNICALL Java_JUtil_setWindowMaximizeEnabled(JNIEnv *env, jclass obj, jint hwnd, jboolean flag) 
{ 
 HMENU hSysMenu = NULL; 

 hSysMenu = GetSystemMenu((HWND) hwnd,FALSE); 

 if (!flag) 
  ModifyMenu(hSysMenu,4,MF_BYPOSITION|MF_GRAYED|MF_STRING,0,"Ma&ximize"); 
 else 
  ModifyMenu(hSysMenu,4,MF_BYPOSITION|MF_ENABLED|MF_STRING,0,"Ma&ximize"); 

 return; 
} 

JNIEXPORT void JNICALL Java_JUtil_setWindowAlwaysOnTop(JNIEnv *env, jclass obj, jint hwnd, jboolean flag) 
{ 
 if (flag) 
  SetWindowPos((HWND) hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); 
 else 
  SetWindowPos((HWND) hwnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); 

 return; 
} 
  

Listing 3. 

/* DO NOT EDIT THIS FILE - it is machine generated */ 
#include <jni.h> 
/* Header for class JUtil */ 

#ifndef _Included_JUtil 
#define _Included_JUtil 
#ifdef __cplusplus 
extern "C" { 
#endif 
/* 
 * Class:     JUtil 
 * Method:    getConsoleChar 
 * Signature: ()C 
 */ 
JNIEXPORT jchar JNICALL Java_JUtil_getConsoleChar 
  (JNIEnv *, jclass); 

/* 
 * Class:     JUtil 
 * Method:    getLogicalDrives 
 * Signature: ()[Ljava/lang/String; 
 */ 
JNIEXPORT jobjectArray JNICALL Java_JUtil_getLogicalDrives 
  (JNIEnv *, jclass); 

/* 
 * Class:     JUtil 
 * Method:    getFreeDiskSpace 
 * Signature: (Ljava/lang/String;)J 
 */ 
JNIEXPORT jlong JNICALL Java_JUtil_getFreeDiskSpace 
  (JNIEnv *, jclass, jstring); 

/* 
 * Class:     JUtil 
 * Method:    getDriveType 
 * Signature: (Ljava/lang/String;)I 
 */ 
JNIEXPORT jint JNICALL Java_JUtil_getDriveType 
  (JNIEnv *, jclass, jstring); 

/* 
 * Class:     JUtil 
 * Method:    getVolumeLabel 
 * Signature: (Ljava/lang/String;)Ljava/lang/String; 
 */ 
JNIEXPORT jstring JNICALL Java_JUtil_getVolumeLabel 
  (JNIEnv *, jclass, jstring); 

/* 
 * Class:     JUtil 
 * Method:    setVolumeLabel 
 * Signature: (Ljava/lang/String;Ljava/lang/String;)Z 
 */ 
JNIEXPORT jboolean JNICALL Java_JUtil_setVolumeLabel 
  (JNIEnv *, jclass, jstring, jstring); 

/* 
 * Class:     JUtil 
 * Method:    getCurrentDirectory 
 * Signature: ()Ljava/lang/String; 
 */ 
JNIEXPORT jstring JNICALL Java_JUtil_getCurrentDirectory 
  (JNIEnv *, jclass); 

/* 
 * Class:     JUtil 
 * Method:    setCurrentDirectory 
 * Signature: (Ljava/lang/String;)Z 
 */ 
JNIEXPORT jboolean JNICALL Java_JUtil_setCurrentDirectory 
  (JNIEnv *, jclass, jstring); 

/* 
 * Class:     JUtil 
 * Method:    getHwnd 
 * Signature: (Ljava/lang/String;)I 
 */ 
JNIEXPORT jint JNICALL Java_JUtil_getHwnd 
  (JNIEnv *, jclass, jstring); 

/* 
 * Class:     JUtil 
 * Method:    setWindowMinimized 
 * Signature: (I)V 
 */ 
JNIEXPORT void JNICALL Java_JUtil_setWindowMinimized 
  (JNIEnv *, jclass, jint); 

/* 
 * Class:     JUtil 
 * Method:    setWindowMaximized 
 * Signature: (I)V 
 */ 
JNIEXPORT void JNICALL Java_JUtil_setWindowMaximized 
  (JNIEnv *, jclass, jint); 

/* 
 * Class:     JUtil 
 * Method:    setWindowRestored 
 * Signature: (I)V 
 */ 
JNIEXPORT void JNICALL Java_JUtil_setWindowRestored 
  (JNIEnv *, jclass, jint); 

/* 
 * Class:     JUtil 
 * Method:    setWindowRestoreEnabled 
 * Signature: (IZ)V 
 */ 
JNIEXPORT void JNICALL Java_JUtil_setWindowRestoreEnabled 
  (JNIEnv *, jclass, jint, jboolean); 

/* 
 * Class:     JUtil 
 * Method:    setWindowMoveEnabled 
 * Signature: (IZ)V 
 */ 
JNIEXPORT void JNICALL Java_JUtil_setWindowMoveEnabled 
  (JNIEnv *, jclass, jint, jboolean); 

/* 
 * Class:     JUtil 
 * Method:    setWindowSizeEnabled 
 * Signature: (IZ)V 
 */ 
JNIEXPORT void JNICALL Java_JUtil_setWindowSizeEnabled 
  (JNIEnv *, jclass, jint, jboolean); 

/* 
 * Class:     JUtil 
 * Method:    setWindowMinimizeEnabled 
 * Signature: (IZ)V 
 */ 
JNIEXPORT void JNICALL Java_JUtil_setWindowMinimizeEnabled 
  (JNIEnv *, jclass, jint, jboolean); 

/* 
 * Class:     JUtil 
 * Method:    setWindowMaximizeEnabled 
 * Signature: (IZ)V 
 */ 
JNIEXPORT void JNICALL Java_JUtil_setWindowMaximizeEnabled 
  (JNIEnv *, jclass, jint, jboolean); 

/* 
 * Class:     JUtil 
 * Method:    setWindowAlwaysOnTop 
 * Signature: (IZ)V 
 */ 
JNIEXPORT void JNICALL Java_JUtil_setWindowAlwaysOnTop 
  (JNIEnv *, jclass, jint, jboolean); 

#ifdef __cplusplus 
} 
#endif 
#endif 


  

 

All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.