Package org.openstreetmap.josm.gui.util
Class CursorManager
- java.lang.Object
-
- org.openstreetmap.josm.gui.util.CursorManager
-
public class CursorManager extends java.lang.Object
This class manages multiple cursors for multiple components. All components share the same cursor that was last set usingsetNewCursor(Cursor, Object)
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.CopyOnWriteArrayList<java.awt.Component>componentsprivate java.util.LinkedHashMap<java.lang.Object,java.awt.Cursor>cursors
-
Constructor Summary
Constructors Constructor Description CursorManager(java.awt.Component forComponent)Creates a new NavigationCursorManager
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddComponent(java.awt.Component forComponent)Adds a component that this manager should send cursor changes to.private java.awt.CursorgetCurrentCursor()voidremoveComponent(java.awt.Component forComponent)Removes a component that this manager should send cursor changes to.voidresetCursor(java.lang.Object reference)Remove the new cursor that was set with the given reference object.voidsetNewCursor(java.awt.Cursor cursor, java.lang.Object reference)Set new cursor.private voidupdateCursor()
-
-
-
Field Detail
-
cursors
private final java.util.LinkedHashMap<java.lang.Object,java.awt.Cursor> cursors
-
components
private final java.util.concurrent.CopyOnWriteArrayList<java.awt.Component> components
-
-
Constructor Detail
-
CursorManager
public CursorManager(java.awt.Component forComponent)
Creates a new NavigationCursorManager- Parameters:
forComponent- The initial component the cursor should be managed for.
-
-
Method Detail
-
addComponent
public void addComponent(java.awt.Component forComponent)
Adds a component that this manager should send cursor changes to.- Parameters:
forComponent- The component.
-
removeComponent
public void removeComponent(java.awt.Component forComponent)
Removes a component that this manager should send cursor changes to. The current cursor is not reset.- Parameters:
forComponent- The component.
-
setNewCursor
public void setNewCursor(java.awt.Cursor cursor, java.lang.Object reference)
Set new cursor.- Parameters:
cursor- The new cursor to use.reference- A reference object that can be passed to the next set/reset calls to identify the caller.
-
resetCursor
public void resetCursor(java.lang.Object reference)
Remove the new cursor that was set with the given reference object. and reset to previous- Parameters:
reference- A reference object that can be passed to the next set/reset calls to identify the caller.
-
updateCursor
private void updateCursor()
-
getCurrentCursor
private java.awt.Cursor getCurrentCursor()
-
-