APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.awt

public abstract Class GlobalCursorManager

extends Object
Class Inheritance
Known Direct Subclasses
sun.awt.X11.XGlobalCursorManager
Imports
java.awt.*, java.awt.event.InputEvent, .InvocationEvent

A stateless class which responds to native mouse moves, Component resizes, Component moves, showing and hiding of Components, minimizing and maximizing of top level Windows, addition and removal of Components, and calls to setCursor().

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
private final Object
lastUpdateLock

Locking object for synchronizing access to lastUpdateMillis.

private long
lastUpdateMillis

The last time the cursor was updated, in milliseconds.

private final GlobalCursorManager.NativeUpdater
nativeUpdater

Use a singleton NativeUpdater for better performance.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
private void
_updateCursor(boolean useCache)

Updates the global cursor.

protected abstract Component
findHeavyweightUnderCursor(boolean
If true, the implementation is free to use caching mechanisms because the Z-order, visibility, and enabled state of the Components has not changed. If false, the implementation should not make these assumptions.
useCache
)

Returns the most specific, visible, heavyweight Component under the cursor.

protected abstract void
getCursorPos(Point p)

Returns the global cursor position, in screen coordinates.

protected abstract Point
protected abstract void
setCursor(Component comp, Cursor cursor, boolean useCache)

Set the global cursor to the specified cursor.

public void
updateCursorImmediately()

Should be called for any activity at the Java level which may affect the global cursor, except for Java MOUSE_MOVED events.

public void
updateCursorImmediately(InputEvent
the InputEvent which triggered the cursor update.
e
)

Should be called in response to Java MOUSE_MOVED events.

public void
updateCursorLater(Component heavy)

Should be called in response to a native mouse enter or native mouse button released message.

protected void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lastUpdateLockback to summary
private final Object lastUpdateLock

Locking object for synchronizing access to lastUpdateMillis. The VM does not guarantee atomicity of longs.

lastUpdateMillisback to summary
private long lastUpdateMillis

The last time the cursor was updated, in milliseconds.

nativeUpdaterback to summary
private final GlobalCursorManager.NativeUpdater nativeUpdater

Use a singleton NativeUpdater for better performance. We cannot use a singleton InvocationEvent because we want each event to have a fresh timestamp.

Constructor Detail

GlobalCursorManagerback to summary
protected GlobalCursorManager()

Method Detail

_updateCursorback to summary
private void _updateCursor(boolean useCache)

Updates the global cursor. We apply a three-step scheme to cursor updates:

(1) InputEvent updates which are outdated are discarded by updateCursorImmediately(InputEvent).

(2) If 'useCache' is true, the native code is free to use a cached value to determine the most specific, visible, enabled heavyweight because this update is occurring in response to a mouse move. If 'useCache' is false, the native code must perform a new search given the current mouse coordinates. (3) Once we have determined the most specific, visible, enabled heavyweight, we use findComponentAt to find the most specific, visible, enabled Component.

findHeavyweightUnderCursorback to summary
protected abstract Component findHeavyweightUnderCursor(boolean useCache)

Returns the most specific, visible, heavyweight Component under the cursor. This method should return null iff the cursor is not over any Java Window.

Parameters
useCache:boolean

If true, the implementation is free to use caching mechanisms because the Z-order, visibility, and enabled state of the Components has not changed. If false, the implementation should not make these assumptions.

getCursorPosback to summary
protected abstract void getCursorPos(Point p)

Returns the global cursor position, in screen coordinates.

getLocationOnScreenback to summary
protected abstract Point getLocationOnScreen(Component com)
setCursorback to summary
protected abstract void setCursor(Component comp, Cursor cursor, boolean useCache)

Set the global cursor to the specified cursor. The component over which the Cursor current resides is provided as a convenience. Not all platforms may require the Component.

updateCursorImmediatelyback to summary
public void updateCursorImmediately()

Should be called for any activity at the Java level which may affect the global cursor, except for Java MOUSE_MOVED events.

updateCursorImmediatelyback to summary
public void updateCursorImmediately(InputEvent e)

Should be called in response to Java MOUSE_MOVED events. The update will be discarded if the InputEvent is outdated.

Parameters
e:InputEvent

the InputEvent which triggered the cursor update.

updateCursorLaterback to summary
public void updateCursorLater(Component heavy)

Should be called in response to a native mouse enter or native mouse button released message. Should not be called during a mouse drag.

updateCursorOutOfJavaback to summary
protected void updateCursorOutOfJava()
sun.awt back to summary

pack-priv Class GlobalCursorManager.NativeUpdater

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
pack-priv boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pendingback to summary
pack-priv boolean pending

Constructor Detail

NativeUpdaterback to summary
pack-priv NativeUpdater()

Method Detail

postIfNotPendingback to summary
public void postIfNotPending(Component heavy, InvocationEvent in)
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.