Package org.scijava.input
Class DefaultInputService
- java.lang.Object
-
- org.scijava.AbstractContextual
-
- org.scijava.plugin.AbstractRichPlugin
-
- org.scijava.service.AbstractService
-
- org.scijava.input.DefaultInputService
-
- All Implemented Interfaces:
Comparable<Prioritized>,Contextual,Disposable,Identifiable,Initializable,InputService,Locatable,Logged,HasPluginInfo,RichPlugin,SciJavaPlugin,Prioritized,SciJavaService,Service,Versioned
public class DefaultInputService extends AbstractService implements InputService
Default implementation ofInputService.- Author:
- Curtis Rueden
-
-
Constructor Summary
Constructors Constructor Description DefaultInputService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventServiceeventService()Display<?>getDisplay()Gets the display associated with the last observed mouse cursor.InputModifiersgetModifiers()intgetX()Gets the last observed X coordinate of the mouse cursor, relative to a specific display.intgetY()Gets the last observed Y coordinate of the mouse cursor, relative to a specific display.booleanisAltDown()booleanisAltGrDown()booleanisButtonDown(int button)Gets whether the given mouse button is currently pressed.booleanisCtrlDown()booleanisKeyDown(KeyCode code)booleanisMetaDown()booleanisShiftDown()protected voidonEvent(DisplayDeletedEvent evt)voidonEvent(KyPressedEvent evt)voidonEvent(KyReleasedEvent evt)protected voidonEvent(MsExitedEvent evt)protected voidonEvent(MsMovedEvent evt)protected voidonEvent(MsPressedEvent evt)protected voidonEvent(MsReleasedEvent evt)-
Methods inherited from class org.scijava.service.AbstractService
getContext, setContext, toString
-
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
getInfo, getPriority, setInfo, setPriority
-
Methods inherited from class org.scijava.AbstractContextual
context
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.Disposable
dispose
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.input.InputService
getEventService
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.service.Service
initialize, registerEventHandlers
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
-
-
-
Method Detail
-
eventService
public EventService eventService()
- Specified by:
eventServicein interfaceInputService
-
getModifiers
public InputModifiers getModifiers()
- Specified by:
getModifiersin interfaceInputService
-
isAltDown
public boolean isAltDown()
- Specified by:
isAltDownin interfaceInputService
-
isAltGrDown
public boolean isAltGrDown()
- Specified by:
isAltGrDownin interfaceInputService
-
isCtrlDown
public boolean isCtrlDown()
- Specified by:
isCtrlDownin interfaceInputService
-
isMetaDown
public boolean isMetaDown()
- Specified by:
isMetaDownin interfaceInputService
-
isShiftDown
public boolean isShiftDown()
- Specified by:
isShiftDownin interfaceInputService
-
isKeyDown
public boolean isKeyDown(KeyCode code)
- Specified by:
isKeyDownin interfaceInputService
-
getDisplay
public Display<?> getDisplay()
Description copied from interface:InputServiceGets the display associated with the last observed mouse cursor.- Specified by:
getDisplayin interfaceInputService- Returns:
- The display in question, or null if the display has been deleted, or the mouse cursor is outside all known displays, or no mouse events have ever been observed.
-
getX
public int getX()
Description copied from interface:InputServiceGets the last observed X coordinate of the mouse cursor, relative to a specific display.- Specified by:
getXin interfaceInputService- See Also:
InputService.getDisplay()
-
getY
public int getY()
Description copied from interface:InputServiceGets the last observed Y coordinate of the mouse cursor, relative to a specific display.- Specified by:
getYin interfaceInputService- See Also:
InputService.getDisplay()
-
isButtonDown
public boolean isButtonDown(int button)
Description copied from interface:InputServiceGets whether the given mouse button is currently pressed.- Specified by:
isButtonDownin interfaceInputService- Parameters:
button- One of:
-
onEvent
public void onEvent(KyPressedEvent evt)
-
onEvent
public void onEvent(KyReleasedEvent evt)
-
onEvent
protected void onEvent(MsMovedEvent evt)
-
onEvent
protected void onEvent(MsExitedEvent evt)
-
onEvent
protected void onEvent(MsPressedEvent evt)
-
onEvent
protected void onEvent(MsReleasedEvent evt)
-
onEvent
protected void onEvent(DisplayDeletedEvent evt)
-
-