Package VASSAL.build.module.map
Class Scroller
java.lang.Object
VASSAL.build.AbstractBuildable
VASSAL.build.module.map.Scroller
- All Implemented Interfaces:
KeyListener
,EventListener
,Buildable
,PropertyNameSource
,ValidityChecker
public class Scroller extends AbstractBuildable implements KeyListener
This component listens to key events on a Map window and
scrolls the map. Depending on the USE_ARROWS attribute,
will use number keypad or arrow keys, or will offer a
preferences setting for the user to choose
-
Field Summary
Fields Modifier and Type Field Description static String
ALWAYS
static String
NEVER
static String
PROMPT
static String
USE_ARROWS
The attribute name for whether to use arrow keys instead of number keypad.protected String
usingArrows
protected int
xStep
protected int
yStep
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validator
-
Constructor Summary
Constructors Constructor Description Scroller()
-
Method Summary
Modifier and Type Method Description void
add(Buildable b)
Add a Buildable object to this objectvoid
addTo(Buildable parent)
Adds this component to its parent.String[]
getAttributeNames()
Lists all the buildFile (XML) attribute names for this component.String
getAttributeValueString(String name)
void
keyPressed(KeyEvent e)
void
keyReleased(KeyEvent e)
void
keyTyped(KeyEvent e)
void
setAttribute(String name, Object value)
Sets a buildFile (XML) attribute value for this component.Methods inherited from class VASSAL.build.AbstractBuildable
build, getAllDescendantComponents, getAllDescendantComponentsOf, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getPropertyNames, validate
-
Field Details
-
USE_ARROWS
The attribute name for whether to use arrow keys instead of number keypad. Should be one of ALWAYS, NEVER, or PROMPT- See Also:
- Constant Field Values
-
ALWAYS
- See Also:
- Constant Field Values
-
NEVER
- See Also:
- Constant Field Values
-
PROMPT
- See Also:
- Constant Field Values
-
usingArrows
-
xStep
protected int xStep -
yStep
protected int yStep
-
-
Constructor Details
-
Scroller
public Scroller()
-
-
Method Details
-
addTo
Description copied from interface:Buildable
Adds this component to its parent. In order to make Buildable objects extensible, the child is reponsible for adding itself to the parent. That way, Buildable subcomponents can be defined in an extension package without needing to modify the containing class. -
add
Description copied from class:AbstractBuildable
Add a Buildable object to this object- Specified by:
add
in interfaceBuildable
- Overrides:
add
in classAbstractBuildable
-
getAttributeNames
Description copied from class:AbstractBuildable
Lists all the buildFile (XML) attribute names for this component. If this component is ALSO anAbstractConfigurable
, then this list of attributes determines the appropriate attribute order forAbstractConfigurable.getAttributeDescriptions()
andAbstractConfigurable.getAttributeTypes()
.- Specified by:
getAttributeNames
in classAbstractBuildable
- Returns:
- a list of all buildFile (XML) attribute names for this component
-
setAttribute
Description copied from class:AbstractBuildable
Sets a buildFile (XML) attribute value for this component. Thekey
parameter will be one of those listed inAbstractBuildable.getAttributeNames()
. If thevalue
parameter is a String, it will be the value returned byAbstractBuildable.getAttributeValueString(java.lang.String)
for the samekey
. If the implementing class extendsAbstractConfigurable
, thenvalue
will be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
- Specified by:
setAttribute
in classAbstractBuildable
- Parameters:
name
- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()
value
- If thevalue
parameter is a String, it will be the value returned byAbstractBuildable.getAttributeValueString(java.lang.String)
for the samekey
. If the implementing class extendsAbstractConfigurable
, thenvalue
can also be an instance of the corresponding Class listed inAbstractConfigurable.getAttributeTypes()
-
getAttributeValueString
- Specified by:
getAttributeValueString
in classAbstractBuildable
- Parameters:
name
- the name of the attribute. Will be one of those listed inAbstractBuildable.getAttributeNames()
- Returns:
- a String representation of the attribute with the given name. When initializing a module, this String value will be passed to
AbstractBuildable.setAttribute(java.lang.String, java.lang.Object)
.
-
keyPressed
- Specified by:
keyPressed
in interfaceKeyListener
-
keyReleased
- Specified by:
keyReleased
in interfaceKeyListener
-
keyTyped
- Specified by:
keyTyped
in interfaceKeyListener
-