|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwiiremotej.ButtonMap
public class ButtonMap
Maps a button on the remote or an extension to one or more actions. ButtonMaps are immutable (as far as the user is concerned). Note that if you specify both extension buttons and Wii remote buttons, both sets of buttons must be depressed for the action(s) to occur. See WRButtonEvent for Wii remote buttons, WRNunchuckEvent for nunchuk buttons, WRGuitarExtensionEvent for Wii guitar buttons, and WRClassicControllerEvent for classic controller buttons. You may map to a device that is not enabled, but maps to a disabled device will do nothing until the device is enabled, at which point they will function normally. See java.awt.KeyEvent for key map options (any of the VK_ constants are acceptable). The order the keys are pressed and released is determined by their order in the array. It is the user's responsibility to make sure valid keys are entered. If invalid keys are entered, no exception will be thrown until the map is triggered, at which point errors will be generated. See java.awt.InputEvent for mouse button map options. Only InputEvent.BUTTON1_MASK, InputEvent.BUTTON2_MASK, and InputEvent.BUTTON3_MASK are valid mouse buttons. If you map a mouse wheel, note that you have two options: push-to-scroll, and hold-to-scroll. In the former, the button must be pressed and released each time to scroll the scroll amount. In the latter, the button may be held down. The wheel will scroll the scroll amount once per scroll interval (milliseconds).
WRButtonEvent
,
WRNunchukExtensionEvent
,
WRClassicControllerExtensionEvent
Field Summary | |
---|---|
static int |
CLASSIC_CONTROLLER
Indicates the classic controller extension. |
static int |
GUITAR
Indicates the Wii guitar extension. |
static int |
NUNCHUK
Indicates the nunchuk extension. |
Constructor Summary | |
---|---|
ButtonMap(int wiiRemoteButtons,
int[] keys,
int mouseButton,
int scrollAmount,
int scrollInterval)
Creates a new ButtonMap for the Wii remote with the given keys, mouse button, scroll wheel amount, and scroll wheel interval. |
|
ButtonMap(int extension,
int extensionButtons,
int[] keys,
int mouseButton,
int scrollAmount,
int scrollInterval)
Creates a new ButtonMap for the given extension with the given keys, mouse button, scroll wheel amount, and scroll wheel interval. |
|
ButtonMap(int wiiRemoteButtons,
int extension,
int extensionButtons,
int[] keys,
int mouseButton,
int scrollAmount,
int scrollInterval)
Creates a new ButtonMap for the Wii remote and the given extension with the given keys, mouse button, scroll wheel amount, and scroll wheel interval. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object other)
Returns true if this ButtonMap is equivalent to the given ButtonMap; otherwise false . |
int |
getExtension()
Returns the extension on which the extension buttons must be depressed to trigger this ButtonMap. |
int |
getExtensionButtons()
Returns the extension buttons that must be depressed to trigger this ButtonMap. |
int[] |
getKeys()
Returns the keyboard keys pressed when this ButtonMap is triggered or null if this map does not use keys. |
int |
getMouseButton()
Returns the mouse button clicked when this ButtonMap is triggered or -1 if this map does not use a mouse button. |
int |
getScrollAmount()
Returns the scroll amount or 0 if this map does not use the scroll wheel. |
int |
getScrollInterval()
Returns the scroll interval. |
int |
getWiiRemoteButtons()
Returns the Wii remote buttons that must be depressed to trigger this ButtonMap. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NUNCHUK
public static final int CLASSIC_CONTROLLER
public static final int GUITAR
Constructor Detail |
---|
public ButtonMap(int wiiRemoteButtons, int[] keys, int mouseButton, int scrollAmount, int scrollInterval) throws java.lang.IllegalArgumentException
wiiRemoteButtons
- the Wii remote buttons that must be depressed to trigger this ButtonMap. May be either a single button or a multi-button mask.keys
- keyboard keys to map to or null if keys are not used. A list of keys (the VK_ constants) from java.awt.KeyEvent.mouseButton
- mouse button(s) to map to or -1 if mouse button not used. A mouse button mask from java.awt.InputEvent.scrollAmount
- the amount to scroll when the button is pressed or 0 if not used. A positive value indicates scrolling down, and a negative value indicates
scrolling up. The value is in scroll-wheel "notches," i.e. the least amount you can move a scroll wheel on a standard mouse.scrollInterval
- the delay (in milliseconds) between scrolling when holding the button or -1 if you must push to scroll. Must be at least 10, if not -1.
java.lang.IllegalArgumentException
- if there is no action.
java.lang.IllegalArgumentException
- if mouseButton is not some combination of InputEvent.BUTTON1_MASK, InputEvent.BUTTON2_MASK, and InputEvent.BUTTON3_MASK or -1.
java.lang.IllegalArgumentException
- if scrollInterval is less than 10 and not equal to -1.
java.lang.IllegalArgumentException
- if no Wii remote buttons are indicated.public ButtonMap(int extension, int extensionButtons, int[] keys, int mouseButton, int scrollAmount, int scrollInterval) throws java.lang.IllegalArgumentException
extension
- the extension on which the extension buttons must be depressed to trigger the action(s).extensionButtons
- the extension buttons that must be depressed to trigger this ButtonMap. May be either a single button or a multi-button mask.keys
- keyboard keys to map to or null if keys are not used. A list of keys (the VK_ constants) from java.awt.KeyEvent.mouseButton
- mouse button(s) to map to or -1 if mouse button not used. A mouse button mask from java.awt.InputEvent.scrollAmount
- the amount to scroll when the button is pressed or 0 if not used. A positive value indicates scrolling down, and a negative value indicates
scrolling up. The value is in scroll-wheel "notches," i.e. the least amount you can move a scroll wheel on a standard mouse.scrollInterval
- the delay (in milliseconds) between scrolling when holding the button or -1 if you must push to scroll. Must be at least 10, if not -1.
java.lang.IllegalArgumentException
- if there is no action.
java.lang.IllegalArgumentException
- if mouseButton is not some combination of InputEvent.BUTTON1_MASK, InputEvent.BUTTON2_MASK, and InputEvent.BUTTON3_MASK.
java.lang.IllegalArgumentException
- if scrollInterval is less than 10 and not equal to -1.
java.lang.IllegalArgumentException
- if no extension buttons are indicated.public ButtonMap(int wiiRemoteButtons, int extension, int extensionButtons, int[] keys, int mouseButton, int scrollAmount, int scrollInterval) throws java.lang.IllegalArgumentException
wiiRemoteButtons
- the Wii remote buttons that must be depressed to trigger this ButtonMap. May be either a single button or a multi-button mask.extension
- the extension on which the extension buttons must be depressed to trigger the action(s).extensionButtons
- the extension buttons that must be depressed to trigger this ButtonMap. May be either a single button or a multi-button mask.keys
- keyboard keys to map to or null if keys are not used. A list of keys (the VK_ constants) from java.awt.KeyEvent.mouseButton
- mouse button(s) to map to or -1 if mouse button not used. A mouse button mask from java.awt.InputEvent.scrollAmount
- the amount to scroll when the button is pressed or 0 if not used. A positive value indicates scrolling down, and a negative value indicates
scrolling up. The value is in scroll-wheel "notches," i.e. the least amount you can move a scroll wheel on a standard mouse.scrollInterval
- the delay (in milliseconds) between scrolling when holding the button or -1 if you must push to scroll. Must be at least 10, if not -1.
java.lang.IllegalArgumentException
- if there is no action.
java.lang.IllegalArgumentException
- if mouseButton is not some combination of InputEvent.BUTTON1_MASK, InputEvent.BUTTON2_MASK, and InputEvent.BUTTON3_MASK.
java.lang.IllegalArgumentException
- if scrollInterval is less than 10 and not equal to -1.
java.lang.IllegalArgumentException
- if no Wii remote or extension buttons are indicated.Method Detail |
---|
public int getWiiRemoteButtons()
public int getExtension()
public int getExtensionButtons()
public int[] getKeys()
null
if this map does not use keys.
null
if this map does not use keys.public int getMouseButton()
public int getScrollAmount()
public int getScrollInterval()
public boolean equals(java.lang.Object other)
true
if this ButtonMap is equivalent to the given ButtonMap; otherwise false
. All attributes must match. Note that they keys array
must be in the same order in both maps as well.
equals
in class java.lang.Object
other
- the other ButtonMap to compare to.
true
if this ButtonMap is equivalent to the given ButtonMap; otherwise false
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |