Class AbstractComponent

java.lang.Object
net.java.games.input.AbstractComponent
All Implemented Interfaces:
Component
Direct Known Subclasses:
LinuxJoystickPOV, WinTabComponent

public abstract class AbstractComponent extends Object implements Component
Skeleton implementation of a named axis.
  • Constructor Details

    • AbstractComponent

      protected AbstractComponent(String name, Component.Identifier id)
      Protected constructor
      Parameters:
      name - A name for the axis
  • Method Details

    • getIdentifier

      public Component.Identifier getIdentifier()
      Returns the type or identifier of the axis.
      Specified by:
      getIdentifier in interface Component
    • isAnalog

      public boolean isAnalog()
      Returns whether or not the axis is analog, or false if it is digital.
      Specified by:
      isAnalog in interface Component
      Returns:
      false by default, can be overridden
    • getDeadZone

      public float getDeadZone()
      Returns the suggested dead zone for this axis. Dead zone is the amount polled data can vary before considered a significant change in value. An application can safely ignore changes less than this value in the positive or negative direction.
      Specified by:
      getDeadZone in interface Component
      Returns:
      0.0f by default, can be overridden
      See Also:
    • getPollData

      public final float getPollData()
      Returns the data from the last time the control has been polled. If this axis is a button, the value returned will be either 0.0f or 1.0f. If this axis is normalised, the value returned will be between -1.0f and 1.0f.
      Specified by:
      getPollData in interface Component
      Returns:
      The data from the last time the control has been polled.
      See Also:
    • getName

      public String getName()
      Returns a human-readable name for this axis.
      Specified by:
      getName in interface Component
    • toString

      public String toString()
      Returns a non-localized string description of this axis.
      Overrides:
      toString in class Object
    • poll

      protected abstract float poll() throws IOException
      Throws:
      IOException