public class NativeWindowEvent extends EventObject
The event is passed to every NativeWindowListener
or
NativeWindowAdapter
object which registered to receive such
events using the window's addNativeWindowListener
method. Hence,
NativeWindowAdapter
objects implement the
NativeWindowListener
interface. Each such listener object gets
this NativeWindowEvent
when the event occurs.
Native windows are capable of generating the following types of
NativeWindowEvent
s:
WINDOW_OPENED
WINDOW_CLOSING
: WINDOW_CLOSED
WINDOW_ICONIFIED
WINDOW_DEICONIFIED
WINDOW_ACTIVATED
WINDOW_DEACTIVATED
WINDOW_GAINED_FOCUS
WINDOW_LOST_FOCUS
WINDOW_STATE_CHANGED
java.awt.Component
,
java.awt.Container
,
java.awt.Window
,
java.awt.Frame
,
java.awt.Component
. The numeric values of these constants are
these defined in java.awt.ComponentEvent
.
WINDOW_MOVED = ComponentEvent.COMPONENT_MOVED
WINDOW_RESIZED = ComponentEvent.COMPONENT_RESIZED
WINDOW_SHOWN = ComponentEvent.COMPONENT_SHOWN
WINDOW_HIDDEN = ComponentEvent.COMPONENT_HIDDEN
NativeWindowListener
,
NativeWindowAdapter
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
WINDOW_ACTIVATED
The window-activated event type.
|
static int |
WINDOW_CLOSED
The window closed event.
|
static int |
WINDOW_CLOSING
The "window is closing" event.
|
static int |
WINDOW_DEACTIVATED
The window-deactivated event type.
|
static int |
WINDOW_DEICONIFIED
The window deiconified event type.
|
static int |
WINDOW_FIRST
The first number in the range of ids used for window events.
|
static int |
WINDOW_GAINED_FOCUS
The window-gained-focus event type.
|
static int |
WINDOW_HIDDEN
This event indicates that the window was made invisible.
|
static int |
WINDOW_ICONIFIED
The window iconified event.
|
static int |
WINDOW_LAST
The last number in the range of ids used for window events.
|
static int |
WINDOW_LOST_FOCUS
The window-lost-focus event type.
|
static int |
WINDOW_MOVED
This event indicates that the window's position changed.
|
static int |
WINDOW_OPENED
The window opened event.
|
static int |
WINDOW_RESIZED
This event indicates that the window's size changed.
|
static int |
WINDOW_SHOWN
This event indicates that the window was made visible.
|
static int |
WINDOW_STATE_CHANGED
The window-state-changed event type.
|
source
Constructor and Description |
---|
NativeWindowEvent(NativeWindow source,
int id)
Constructs a
NativeWindowEvent object. |
NativeWindowEvent(NativeWindow source,
int id,
int oldState,
int newState)
Constructs a
NativeWindowEvent object with the specified
previous and new window states. |
NativeWindowEvent(NativeWindow source,
int id,
NativeWindow opposite)
Constructs a
NativeWindowEvent object with the specified
previous and new window states. |
Modifier and Type | Method and Description |
---|---|
void |
consume()
Consumes this event, if this event can be consumed.
|
int |
getID()
Returns the event type.
|
int |
getNewState()
For
WINDOW_STATE_CHANGED events returns the new state of the
native window. |
int |
getOldState()
For
WINDOW_STATE_CHANGED events returns the previous state
of the native window. |
NativeWindow |
getOppositeWindow()
Returns the other native window involved in this focus or activation
change.
|
Object |
getSource()
Returns the object on which the event initially occurred.
|
NativeWindow |
getWindow()
Returns the originator of the event.
|
boolean |
isConsumed()
Returns whether this event has been consumed.
|
String |
paramString()
Returns a parameter string identifying this event.
|
String |
toString()
Returns a String representation of this object.
|
public static final int WINDOW_FIRST
public static final int WINDOW_OPENED
public static final int WINDOW_CLOSING
public static final int WINDOW_CLOSED
public static final int WINDOW_ICONIFIED
public static final int WINDOW_DEICONIFIED
public static final int WINDOW_ACTIVATED
public static final int WINDOW_DEACTIVATED
public static final int WINDOW_GAINED_FOCUS
public static final int WINDOW_LOST_FOCUS
public static final int WINDOW_STATE_CHANGED
public static final int WINDOW_LAST
public static final int WINDOW_MOVED
public static final int WINDOW_RESIZED
public static final int WINDOW_SHOWN
public static final int WINDOW_HIDDEN
public NativeWindowEvent(NativeWindow source, int id)
NativeWindowEvent
object.
Note that passing in an invalid id
results in unspecified
behavior. This method throws an IllegalArgumentException
if
source
is null
.
source
- the NativeWindow
object that originated the eventid
- an integer indicating the type of eventIllegalArgumentException
- if source
is nullpublic NativeWindowEvent(NativeWindow source, int id, int oldState, int newState)
NativeWindowEvent
object with the specified
previous and new window states.
Note that passing in an invalid id
results in unspecified
behavior. This method throws an IllegalArgumentException
if
source
is null
.
source
- the Window
object that originated the eventid
- WINDOW_STATE_CHANGED
event type. It is expected
that this constructor will not be used for other
NativeWindowEvent
types, because the previous and
new window states are meaningless for other event types.oldState
- an integer representing the previous window statenewState
- an integer representing the new window stateIllegalArgumentException
- if source
is nullpublic NativeWindowEvent(NativeWindow source, int id, NativeWindow opposite)
NativeWindowEvent
object with the specified
previous and new window states.
Note that passing in an invalid id
results in unspecified
behavior. This method throws an IllegalArgumentException
if
source
is null
.
source
- the Window
object that originated the eventid
- WINDOW_STATE_CHANGED
event type. It is expected
that this constructor will not be used for other
NativeWindowEvent
types, because the previous and
new window states are meaningless for other event types.opposite
- an integer representing the previous window stateIllegalArgumentException
- if source
is nullpublic NativeWindow getWindow()
public NativeWindow getOppositeWindow()
NativeWindowEvent
, or if the
focus or activation change occurs with a native application, with a
non-native Java window int this or a different VM or context, or with no
other native window, null is returned.public int getOldState()
WINDOW_STATE_CHANGED
events returns the previous state
of the native window. The state is represented as a bitwise mask.
NORMAL
ICONIFIED
MAXIMIZED_HORIZ
MAXIMIZED_VERT
MAXIMIZED_BOTH
MAXIMIZED_HORIZ
and MAXIMIZED_VERT
.
NativeWindow.getExtendedState()
public int getNewState()
WINDOW_STATE_CHANGED
events returns the new state of the
native window. The state is represented as a bitwise mask.
NORMAL
ICONIFIED
MAXIMIZED_HORIZ
MAXIMIZED_VERT
MAXIMIZED_BOTH
MAXIMIZED_HORIZ
and MAXIMIZED_VERT
.
NativeWindow.getExtendedState()
public String paramString()
public void consume()
public int getID()
public boolean isConsumed()
true
if this event has been consumed;
false
otherwise.public String toString()
toString
in class EventObject
public Object getSource()
getSource
in class EventObject
Copyright © 2009 - 2016 DataGis. All Rights Reserved.