|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjutil.JUtil
public final class JUtil
A Windows®-specific Java utility class.
Field Summary | |
---|---|
static int |
DRIVE_CDROM
The drive is a CD-ROM drive. |
static int |
DRIVE_FIXED
The disk cannot be removed from the drive. |
static int |
DRIVE_NO_ROOT_DIR
The root directory does not exist. |
static int |
DRIVE_RAMDISK
The drive is a RAM disk. |
static int |
DRIVE_REMOTE
The drive is a remote (network) drive. |
static int |
DRIVE_REMOVABLE
The disk can be removed from the drive. |
static int |
DRIVE_UNKNOWN
The drive type cannot be determined. |
Constructor Summary | |
---|---|
private |
JUtil()
|
Method Summary | |
---|---|
static void |
copyFile(String source,
String dest)
Copies the specified source file to the specified destination file. |
static char |
getConsoleChar()
Retrieves the character typed at the command console. |
static String |
getCurrentDirectory()
Retrieves the current directory. |
static int |
getDriveType(String drive)
Retrieves the specified drive's type. |
static long |
getFreeDiskSpace(String drive)
Retrieves the specified drive's free disk space. |
static int |
getHwnd(String title)
Retrieves the Win32® window handle for the specified window title. |
static String[] |
getLogicalDrives()
Retrieves the system's logical drives. |
static String |
getVolumeLabel(String drive)
Retrieves the specified volume's label. |
static void |
setContainerDefaultFont(Container cont,
Font f)
Sets the specified container's components to the specified font. |
static boolean |
setCurrentDirectory(String directory)
Sets the current directory. |
static void |
setMenuBarDefaultFont(MenuBar mb,
Font f)
Sets the specified menubar's menus and menu items to the specified font. |
static void |
setWindowAlwaysOnTop(int hwnd,
boolean flag)
Sets the specified window as the topmost window in the z-order. |
static void |
setWindowMaximized(int hwnd)
Maximizes the specified window. |
static void |
setWindowMaximizeEnabled(int hwnd,
boolean flag)
Enables/disables the specified window's Maximize button. |
static void |
setWindowMinimized(int hwnd)
Minimizes the specified window. |
static void |
setWindowMinimizeEnabled(int hwnd,
boolean flag)
Enables/disables the specified window's Minimize button. |
static void |
setWindowMoveEnabled(int hwnd,
boolean flag)
Enables/disables the specified window's Move system menu item. |
static void |
setWindowRestored(int hwnd)
Restores the specified window. |
static void |
setWindowRestoreEnabled(int hwnd,
boolean flag)
Enables/disables the specified window's Restore button. |
static void |
setWindowSizeEnabled(int hwnd,
boolean flag)
Enables/disables the specified window's Size system menu item. |
static boolean |
setVolumeLabel(String drive,
String label)
Sets the specified volume's label. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DRIVE_UNKNOWN
public static final int DRIVE_NO_ROOT_DIR
public static final int DRIVE_REMOVABLE
public static final int DRIVE_FIXED
public static final int DRIVE_REMOTE
public static final int DRIVE_CDROM
public static final int DRIVE_RAMDISK
Constructor Detail |
---|
private JUtil()
Method Detail |
---|
public static char getConsoleChar()
public static String[] getLogicalDrives()
String
objects that contains the logical drive names in the form of
x:\
where x
denotes the drive letterpublic static long getFreeDiskSpace(String drive)
drive
- a String
that specifies the root directory of the disk to return free disk space
information about. If drive
is null
the method uses the root of the
current directory.
getLogicalDrives()
public static int getDriveType(String drive)
drive
- a String
that specifies the root directory of the disk to return the drive type
information about. If drive
is null
the method uses the root of the
current directory.
int
that specifies the drive typegetLogicalDrives()
,
DRIVE_UNKNOWN
,
DRIVE_NO_ROOT_DIR
,
DRIVE_REMOVABLE
,
DRIVE_FIXED
,
DRIVE_REMOTE
,
DRIVE_CDROM
,
DRIVE_RAMDISK
public static String getVolumeLabel(String drive)
drive
- a String
that specifies the root directory of the disk to return the volume label. If
drive
is null
the method uses the root of the current directory.
String
containing the specified volume's labelgetLogicalDrives()
public static boolean setVolumeLabel(String drive, String label)
drive
- a String
that specifies the root directory of the disk to set the volume label. If
drive
is null
the method uses the root of the current directory.label
- a String
that represents the volume's label name. The maximum number of characters for
a volume label is 11. If label
is more that 11 characters long the volume's label will
not be set. If label
is null
the specified volume's label is deleted.
boolean
specifying whether the volume's label was set. true
if the
volume's label was set, false
otherwise.getLogicalDrives()
public static String getCurrentDirectory()
String
representing the current directorypublic static boolean setCurrentDirectory(String directory)
directory
- a String
that specifies the current directory to set
boolean
indicating if the current directory was set. true
if the
current directory was set, false
otherwise.public static int getHwnd(String title)
title
- the title of the window whose Win32® window handle to retrieve
int
representing the Win32® window handle for the specified window titlepublic static void setWindowMinimized(int hwnd)
hwnd
- the window's Win32® handlegetHwnd(java.lang.String)
public static void setWindowMaximized(int hwnd)
hwnd
- the window's Win32® handlegetHwnd(java.lang.String)
public static void setWindowRestored(int hwnd)
hwnd
- the window's Win32® handlegetHwnd(java.lang.String)
public static void setWindowRestoreEnabled(int hwnd, boolean flag)
Restore
button.
hwnd
- the window's Win32® handleflag
- a boolean
parameter that specifies whether to enable or disable the window's
Restore
button. true
enables the button,
false
disables the button.getHwnd(java.lang.String)
public static void setWindowMoveEnabled(int hwnd, boolean flag)
Move
system menu item.
hwnd
- the window's Win32® handleflag
- a boolean
parameter that specifies whether to enable or disable the window's
Move
system menu item. true
enables the menu item,
false
disables the menu item.getHwnd(java.lang.String)
public static void setWindowSizeEnabled(int hwnd, boolean flag)
Size
system menu item.
hwnd
- the window's Win32® handleflag
- a boolean
parameter that specifies whether to enable or disable the window's
Size
system menu item. true
enables the menu item,
false
disables the menu item.getHwnd(java.lang.String)
public static void setWindowMinimizeEnabled(int hwnd, boolean flag)
Minimize
button.
hwnd
- the window's Win32® handleflag
- a boolean
parameter that specifies whether to enable or disable the window's
Minimize
button. true
enables the button,
false
disables the button.getHwnd(java.lang.String)
public static void setWindowMaximizeEnabled(int hwnd, boolean flag)
Maximize
button.
hwnd
- the window's Win32® handleflag
- a boolean
parameter that specifies whether to enable or disable the window's
Maximize
button. true
enables the button,
false
disables the button.getHwnd(java.lang.String)
public static void setWindowAlwaysOnTop(int hwnd, boolean flag)
hwnd
- the window's Win32® handleflag
- a boolean
parameter that specifies whether the window will be the topmost window in the
z-order. true
sets the window as the topmost window in the z-order,
false
sets the window behind all topmost windows.getHwnd(java.lang.String)
public static void setContainerDefaultFont(Container cont, Font f) throws IllegalArgumentException
cont
- the Container
whose components will be set with the specified fontf
- the Font
object that will be used
IllegalArgumentException
- if cont
or f
are null
Container
,
Font
public static void setMenuBarDefaultFont(MenuBar mb, Font f) throws IllegalArgumentException
mb
- the MenuBar
whose menus and menu items will be set with the specified fontf
- the Font
object that will be used
IllegalArgumentException
- if mb
or f
are null
MenuBar
,
Font
public static void copyFile(String source, String dest) throws IllegalArgumentException, FileNotFoundException, IOException
source
- the source file namedest
- the destination file name
IllegalArgumentException
- if the source
or dest
file names are null or empty
FileNotFoundException
- if the source file name does not exist
IOException
- if a problem was encountered reading from the source file or writing to the
destination file
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |