public class NativeHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static long |
WS_BORDER
Creates a window that has a thin-line border.
|
static long |
WS_CAPTION
Creates a window that has a title bar (includes the WS_BORDER style).
|
static long |
WS_DEFAULT
Same as WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_THICKFRAME | WS_CAPTION | WS_VISIBLE
|
static long |
WS_DLGFRAME
Creates a window that has a border of a style typically used with dialog boxes.
|
static long |
WS_EX_TRANSPARENT
Creates a window that is transparent (partially opaque).
|
static long |
WS_HSCROLL
Creates a window that has a horizontal scroll bar.
|
static long |
WS_MAXIMIZE
Creates a window that is initially maximized.
|
static long |
WS_MAXIMIZEBOX
Creates a window that has a Maximize button.
|
static long |
WS_MINIMIZE
Creates a window that is initially minimized.
|
static long |
WS_MINIMIZEBOX
Creates a window that has a Minimize button.
|
static long |
WS_OVERLAPPED
Creates an overlapped window.
|
static long |
WS_OVERLAPPEDWINDOW
Same as WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
|
static long |
WS_POPUP
Creates a pop-up window.
|
static long |
WS_POPUPWINDOW
Same as WS_POPUP | WS_BORDER | WS_SYSMENU
|
static long |
WS_SYSMENU
Creates a window that has a System-menu box in its title bar.
|
static long |
WS_THICKFRAME
Creates a window that has a sizing border.
|
static long |
WS_VISIBLE
Creates a window that is initially visible.
|
static long |
WS_VSCROLL
Creates a window that has a vertical scroll bar.
|
Constructor and Description |
---|
NativeHandler(java.lang.String dllPath)
Constructs a NativeHandler to be used without the native window.
|
NativeHandler(java.lang.String dllPath,
int select)
Constructs a NativeHandler to be used without the native window.
|
NativeHandler(java.lang.String dllPath,
java.lang.Object exposedObj)
Constructs a NativeHandler to be used without the native window.
|
NativeHandler(java.lang.String dllPath,
java.lang.Object exposedObj,
int select)
Constructs a NativeHandler to be used without the native window.
|
NativeHandler(java.lang.String dllPath,
java.lang.Object exposedObj,
int select,
java.lang.String title,
int ulx,
int uly,
int width,
int height,
long windowStyle)
Constructs a NativeHandler and creates a native window with given title, position, size and style.
|
NativeHandler(java.lang.String dllPath,
java.lang.Object exposedObj,
java.lang.String title,
int ulx,
int uly,
int width,
int height,
long windowStyle)
Same as NativeHandler(dllPath, exposedObj, select, title, ulx, uly, width, height, windowStyle)
with select = 0.
|
NativeHandler(java.lang.String dllPath,
java.lang.String title,
int ulx,
int uly,
int width,
int height,
long windowStyle)
Same as NativeHandler(dllPath, exposedObj, select, title, ulx, uly, width, height, windowStyle)
with no exposed object and select = 0.
|
Modifier and Type | Method and Description |
---|---|
void |
addTrayIconListener(TrayIconListener listener,
int iconEventMask)
Registers the given listener, in order to get mouse events when the mouse
cursor is inside the tray icon.
|
int |
countBuf()
Returns the count of available (pending) elements in the native JNIBuffer.
|
void |
createBuf(boolean[] ary)
Same as createBuf(ary, bufSize) with bufSize = 1000.
|
void |
createBuf(boolean[] ary,
int bufSize)
Creates a (native) JNIBuffer of given size and links the
native buffer and the the given Java buffer.
|
void |
createBuf(byte[] ary)
Same as createBuf(byte[] ary, int bufSize) with bufSize = 1000.
|
void |
createBuf(byte[] ary,
int bufSize)
Same as createBuf(boolean[] ary, int bufSize), but for a byte array.
|
void |
createBuf(char[] ary)
Same as createBuf(char[] ary, int bufSize) with bufSize = 1000.
|
void |
createBuf(char[] ary,
int bufSize)
Same as createBuf(boolean[] ary, int bufSize), but for a char array.
|
void |
createBuf(double[] ary)
Same as createBuf(double[] ary, int bufSize) with bufSize = 1000.
|
void |
createBuf(double[] ary,
int bufSize)
Same as createBuf(boolean[] ary, int bufSize), but for a double array.
|
void |
createBuf(float[] ary)
Same as createBuf(float[] ary, int bufSize) with bufSize = 1000.
|
void |
createBuf(float[] ary,
int bufSize)
Same as createBuf(boolean[] ary, int bufSize), but for a float array.
|
void |
createBuf(int[] ary)
Same as createBuf(int[] ary, int bufSize) with bufSize = 1000.
|
void |
createBuf(int[] ary,
int bufSize)
Same as createBuf(boolean[] ary, int bufSize), but for an int array.
|
void |
createBuf(long[] ary)
Same as createBuf(long[] ary, int bufSize) with bufSize = 1000.
|
void |
createBuf(long[] ary,
int bufSize)
Same as createBuf(boolean[] ary, int bufSize), but for a long array.
|
void |
createBuf(short[] ary)
Same as createBuf(short[] ary, int bufSize) with bufSize = 1000.
|
void |
createBuf(short[] ary,
int bufSize)
Same as createBuf(boolean[] ary, int bufSize), but for a short array.
|
void |
destroy()
Closes the native window and releases all native resources.
|
void |
expose(java.lang.Object exposedObj)
Allow the native code to have access to the given object.
|
void |
flushBuf()
Flushes the native JNIBuffer.
|
void |
hideIcon()
Hides the tray icon.
|
void |
hideWindow()
Hides the window, but does not release any resources.
|
int |
invoke()
Invokes the native function with value = 0.
|
int |
invoke(int val)
Invokes the native function with given value.
|
boolean |
isBufOverflow(boolean reset)
Checks for a possible overflow of the JNIBuffer.
|
int |
readBuf(int count)
Reads up to count elements from a native JNIBuffer into the previously
created Java buffer.
|
void |
setWindowPosition(int ulx,
int uly)
Moves the window to the given position (upper left corner).
|
void |
setWindowSize(int width,
int height)
Resizes the window to given size (width, height).
|
void |
showBalloonTooltip(java.lang.String title,
java.lang.String text,
int flag,
int timeout)
Shows a ballon tool tip at the tray icon that contains the given title
and text for the given timeout time.
|
void |
showIcon(java.lang.String iconPath)
Same as showIcon(iconPath, tooltip), but no tool tip is shown.
|
void |
showIcon(java.lang.String iconPath,
java.lang.String tooltip)
Shows tray icon given by iconPath.
|
void |
showWindow()
Shows the native window.
|
void |
showWindow(int percent)
Shows a transparent native window with given opacity.
|
void |
showWindow(int percent,
int red,
int green,
int blue)
Shows a transparent native window with given opacity and RGB color for transparent areas.
|
void |
startThread()
Start a native high priority thread.
|
void |
stopThread()
Stop a native high priority thread.
|
public static final long WS_OVERLAPPED
public static final long WS_SYSMENU
public static final long WS_BORDER
public static final long WS_POPUP
public static final long WS_MINIMIZEBOX
public static final long WS_MAXIMIZEBOX
public static final long WS_THICKFRAME
public static final long WS_CAPTION
public static final long WS_VISIBLE
public static final long WS_EX_TRANSPARENT
public static final long WS_MINIMIZE
public static final long WS_MAXIMIZE
public static final long WS_DLGFRAME
public static final long WS_VSCROLL
public static final long WS_HSCROLL
public static final long WS_DEFAULT
public static final long WS_OVERLAPPEDWINDOW
public static final long WS_POPUPWINDOW
public NativeHandler(java.lang.String dllPath, java.lang.Object exposedObj, int select, java.lang.String title, int ulx, int uly, int width, int height, long windowStyle)
dllPath
- the path of the native library (DLL). If only the filename is given, searches in current directory and environment pathexposedObj
- the object that opens access from native codeselect
- the selection of a subclass of WindowHandlertitle
- the window's title in the title barulx
- the x-coordinate of the window's upper left corner (in pixels)uly
- the y-coordinate of the window's upper left corner (in pixels)width
- the width of the window (in pixels)height
- the height of the window (in pixels)windowStyle
- the style of the window (OR-combination of style-constants)UnexpectedLinkError
- if the given library cannot be loadedpublic NativeHandler(java.lang.String dllPath, java.lang.Object exposedObj, java.lang.String title, int ulx, int uly, int width, int height, long windowStyle)
dllPath
- the path of the native library (DLL). If only the filename is given, searches in current directory and environment pathexposedObj
- the object that opens access from native codetitle
- the window's title in the title barulx
- the x-coordinate of the window's upper left corner (in pixels)uly
- the y-coordinate of the window's upper left corner (in pixels)width
- the width of the window (in pixels)height
- the height of the window (in pixels)windowStyle
- the style of the window (OR-combination of style-constants)UnexpectedLinkError
- if the given library cannot be loadedNativeHandler(String dllPath, Object exposedObj, int select, String title,
int ulx, int uly, int width, int height, long windowStyle)
public NativeHandler(java.lang.String dllPath, java.lang.String title, int ulx, int uly, int width, int height, long windowStyle)
dllPath
- the path of the native library (DLL). If only the filename is given, searches in current directory and environment pathtitle
- the window's title in the title barulx
- the x-coordinate of the window's upper left corner (in pixels)uly
- the y-coordinate of the window's upper left corner (in pixels)width
- the width of the window (in pixels)height
- the height of the window (in pixels)windowStyle
- the style of the window (OR-combination of style-constants)UnexpectedLinkError
- if the given library cannot be loadedNativeHandler(String dllPath, Object exposedObj, int select, String title,
int ulx, int uly, int width, int height, long windowStyle)
public NativeHandler(java.lang.String dllPath, java.lang.Object exposedObj, int select)
dllPath
- the path of the native library (DLL). If only the filename is given, searches in current directory and environment pathexposedObj
- the object that opens access from native codeselect
- the selection of a subclass of WindowHandlerUnexpectedLinkError
- if the given library cannot be loadedpublic NativeHandler(java.lang.String dllPath, java.lang.Object exposedObj)
dllPath
- the path of the native library (DLL). If only the filename is given, searches in current directory and environment pathexposedObj
- the object that opens access from native codeUnexpectedLinkError
- if the given library cannot be loadedNativeHandler(String dllPath, Object exposedObj, int select)
public NativeHandler(java.lang.String dllPath, int select)
dllPath
- the path of the native library (DLL). If only the filename is given, searches in current directory and environment pathselect
- the selection of a subclass of WindowHandlerUnexpectedLinkError
- if the given library cannot be loadedNativeHandler(String dllPath, Object exposedObj, int select)
public NativeHandler(java.lang.String dllPath)
dllPath
- the path of the native library (DLL). If only the filename is given, searches in current directory and environment pathUnexpectedLinkError
- if the given library cannot be loadedNativeHandler(String dllPath, Object exposedObj, int select)
public void expose(java.lang.Object exposedObj)
exposedObj
- the object that opens access from native codepublic void showWindow()
public void showWindow(int percent)
percent
- the percentage of opacity in range 0..100public void showWindow(int percent, int red, int green, int blue)
percent
- the percentage of opacity in range 0..100red
- the red portion of the transparency color (0..255)green
- the green portion of the transparency color (0..255)blue
- the blue portion of the transparency color (0..255)public void hideWindow()
public void setWindowPosition(int ulx, int uly)
ulx
- the x-coordinate of the window's upper left corner (in pixels)uly
- the y-coordinate of the window's upper left corner (in pixels)public void setWindowSize(int width, int height)
width
- the width of the window (in pixels)height
- the height of the window (in pixels)public void destroy()
public int invoke(int val)
val
- the integer value to be passed to the native functionpublic int invoke()
public void createBuf(boolean[] ary, int bufSize)
Example:
char[] values = new char[4];
createBuf(values, 6);
Native code fills JNIBuffer:
writeChar('A');
writeChar('B');
writeChar('C'):
JNIBuffer (circular) size 6
-------------------------
| A | B | C | | | |
-------------------------
Java code transfers up to 2 elements:
readBuf(2);
Java buffer size 4
-----------------
| A | B | | |
-----------------
ary
- the Java array getting the native databufSize
- the size (number of elements) of the native buffer.readBuf(int count)
public void createBuf(boolean[] ary)
public void createBuf(char[] ary, int bufSize)
public void createBuf(char[] ary)
public void createBuf(byte[] ary, int bufSize)
public void createBuf(byte[] ary)
public void createBuf(short[] ary, int bufSize)
public void createBuf(short[] ary)
public void createBuf(int[] ary, int bufSize)
public void createBuf(int[] ary)
public void createBuf(long[] ary, int bufSize)
public void createBuf(long[] ary)
public void createBuf(float[] ary, int bufSize)
public void createBuf(float[] ary)
public void createBuf(double[] ary, int bufSize)
public void createBuf(double[] ary)
public int readBuf(int count)
count
- the maximal number of elements to fetch from the JNIBuffercreateBuf(boolean[] ary, int bufsize)
public void flushBuf()
public int countBuf()
createBuf(boolean[] ary, int bufsize)
public boolean isBufOverflow(boolean reset)
reset
- if true, resets a possible overflow condition, if false, the condition is unchangedflushBuf()
,
createBuf(boolean[] ary, int bufsize)
public void startThread()
public void stopThread()
public void addTrayIconListener(TrayIconListener listener, int iconEventMask)
NativeMouse
,
TrayIcon
,
TrayIconListener
public void showIcon(java.lang.String iconPath, java.lang.String tooltip)
iconPath
- the filename of the icon file. If drive:\dir is missing, the directory of the Java class file is assumedtooltip
- the text to be displayed in the tool tip area. When empty, no tool tip is shownpublic void showIcon(java.lang.String iconPath)
iconPath
- the filename of the icon file. If drive:\dir is missing, the directory of the Java class file is assumedshowIcon(String iconPath, String tooltip)
public void hideIcon()
destroy()
public void showBalloonTooltip(java.lang.String title, java.lang.String text, int flag, int timeout)
title
- the title (up to 63 characters) shown bold in the tool tip. When empty, no title is showntext
- the text (up to 253 characters) to be displayed in the tool tip area. When empty, no text is shownflag
- an integer 0..3 selecting the type of a small icontimeout
- the time in milliseconds until the tool tip disappears