Package org.openstreetmap.josm.gui.util
Class CursorManager
- java.lang.Object
-
- org.openstreetmap.josm.gui.util.CursorManager
-
public class CursorManager extends 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 CopyOnWriteArrayList<Component>
components
private LinkedHashMap<Object,Cursor>
cursors
-
Constructor Summary
Constructors Constructor Description CursorManager(Component forComponent)
Creates a new NavigationCursorManager
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addComponent(Component forComponent)
Adds a component that this manager should send cursor changes to.private Cursor
getCurrentCursor()
void
removeComponent(Component forComponent)
Removes a component that this manager should send cursor changes to.void
resetCursor(Object reference)
Remove the new cursor that was set with the given reference object.void
setNewCursor(Cursor cursor, Object reference)
Set new cursor.private void
updateCursor()
-
-
-
Field Detail
-
cursors
private final LinkedHashMap<Object,Cursor> cursors
-
components
private final CopyOnWriteArrayList<Component> components
-
-
Constructor Detail
-
CursorManager
public CursorManager(Component forComponent)
Creates a new NavigationCursorManager- Parameters:
forComponent
- The initial component the cursor should be managed for.
-
-
Method Detail
-
addComponent
public void addComponent(Component forComponent)
Adds a component that this manager should send cursor changes to.- Parameters:
forComponent
- The component.
-
removeComponent
public void removeComponent(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(Cursor cursor, 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(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 Cursor getCurrentCursor()
-
-