FileDocCategorySizeDatePackage
NativeEvent.javaAPI DocAndroid 1.5 API7854Wed May 06 22:41:54 BST 2009org.apache.harmony.awt.wtk

NativeEvent

public abstract class NativeEvent extends Object
The interface describing cross-platform translation of system messages.

Some messages can appear only on specific platform, but they still can have cross-platform interpretation if the application should be aware of them and can react using cross-platform API.

Fields Summary
public static final int
ID_PLATFORM
Message has no common cross-platform interpretation and should be skipped.
public static final int
ID_BOUNDS_CHANGED
Window bounds have changed.
public static final int
ID_INSETS_CHANGED
Window decoration size has changed.
public static final int
ID_CREATED
Window was just created (WM_CREATE on Windows)
public static final int
ID_MOUSE_GRAB_CANCELED
Mouse grab was canceled by the native system
public static final int
ID_THEME_CHANGED
System color scheme or visual theme was changed
protected long
windowId
protected int
eventId
protected long
otherWindowId
protected Point
screenPos
protected Point
localPos
protected Rectangle
windowRect
protected int
modifiers
protected int
mouseButton
protected int
wheelRotation
protected KeyInfo
keyInfo
protected int
windowState
protected long
time
Constructors Summary
Methods Summary
public abstract java.awt.RectanglegetClipBounds()
Returns the "dirty" area of the window as one rectangle. This area is to be painted.

return
non-null Rectangle

public abstract org.apache.harmony.awt.gl.MultiRectAreagetClipRects()
Returns the "dirty" area of the window as set of non-intersecting rectangles. This area is to be painted.

return
non-empty array of null if empty

public intgetEventId()
Returns cross-platform event id should be one of ID_* constants or id constants from java.awt.AWTEvent subclasess

return
cross-platform event id

        return eventId;
    
public intgetInputModifiers()
Returns the state of keyboard and mouse buttons when the event occured if event from mouse or keyboard, for other events can return junk values. The value is bitwise OR of java.awt.event.InputEvent *_DOWN constants. Method is aware of system mouse button swap for left-hand mouse and return swapped values.

return
bitwise OR of java.awt.event.InputEvent *_DOWN constants

        return modifiers;
    
public abstract java.awt.InsetsgetInsets()
Returns the window insets. Insets is area which belongs to window somehow but is outside of it's client area, it usually contains system provided border and titlebar.

return
non-null java.awt.Insets

public java.lang.StringBuffergetKeyChars()
Return the string of characters associated with the event Has meaning only for KEY_PRESSED as should be translated to serie of KEY_TYPED events. For dead keys and input methods one key press can generate multiple key chars.

return
string of characters

        if (keyInfo == null) {
            return null;
        }
        if (keyInfo.vKey == KeyEvent.VK_ENTER) {
            keyInfo.keyChars.setLength(0);
            keyInfo.setKeyChars('\n");
        }
        return keyInfo.keyChars;
    
public intgetKeyLocation()
The same meaning as java.awt.event.getKeyLocation

return
java.awt.event KEY_LOCATION_* constant

        return (keyInfo != null) ? keyInfo.keyLocation : KeyInfo.DEFAULT_LOCATION;
    
public chargetLastChar()

        if (keyInfo == null || keyInfo.keyChars.length() == 0) {
            return KeyEvent.CHAR_UNDEFINED;
        }
        return keyInfo.keyChars.charAt(keyInfo.keyChars.length()-1);
    
public java.awt.PointgetLocalPos()
Returns the position of cursor when event occured relative to top-left corner of recipient window

return
position of cursor in local coordinates

        return localPos;
    
public intgetMouseButton()
Returns the number of mouse button which changed it's state, otherwise 0. Left button is 1, middle button is 2, right button is 3. Method is aware of system mouse button swap for left-hand mouse and return swapped values.

return
mouse button number

        return mouseButton;
    
public longgetOtherWindowId()
For the focus event contains the oposite window. This means it lost focus if recipient gains it, or will gain focus if recipient looses it.

return
HWND on Windows, xwindnow on X

        return otherWindowId;
    
public java.awt.PointgetScreenPos()
Returns the position of cursor when event occured in screen coordinates.

return
position of cursor in screen coordinates

        return screenPos;
    
public longgetTime()
Returns time when the message was received

return
time in milliseconds

        return time;
    
public abstract booleangetTrigger()
Returns true if event is popup menu trigger.

return
boolean flag

public intgetVKey()
The same meaning as java.awt.event.getKeyCode

return
java.awt.event VK_* constant

        return (keyInfo != null) ? keyInfo.vKey : KeyInfo.DEFAULT_VKEY;
    
public intgetWheelRotation()
Returns the number of "clicks" the mouse wheel was rotated.

return
negative values if the mouse wheel was rotated up/away from the user, and positive values if the mouse wheel was rotated down/ towards the user

        return wheelRotation;
    
public longgetWindowId()
Returns the system window id of the event recipient.

return
HWND on Windows, xwindnow on X


                         
       
        return windowId;
    
public java.awt.RectanglegetWindowRect()
The recipient window bounds when the event occured

return
window bounds

        return windowRect;
    
public intgetWindowState()
Returns the iconified/maximized state of recipient window if event is state related, for other events can junk values. The value has the same meaning as Frame.getExtendedState It's bitwise OR of ICONIFIED, MAXIMIZED_HORIZ, MAXIMIZED_VERT

return
bitwise OR of ICONIFIED, MAXIMIZED_HORIZ, MAXIMIZED_VERT

        return windowState;