public class IlvButtonInteractor extends IlvObjectInteractor
ARM
action event,
when the object is clicked on,
the DISARM
action event when
the mouse button is released,
and the ACTIVATE
action event when
the mouse button is released over the object.
The ARM
and DISARM
action events let
you perform a specific graphic operation on the object
(changing its color, for example) to indicate
that an action is about to be
performed. The ACTIVATE
action event carries out the
action associated with the button.
You may code a listener as below:
graphic.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (event.getID() == IlvButtonInteractor.ARM) { graphic.setBackgound(Color.red); graphic.reDraw(); } else if (event.getID() == IlvButtonInteractor.DISARM) { graphic.setBackground(Color.gray); graphic.reDraw(); } else // ACTIVATE performMyAction(); } })
Modifier and Type | Field and Description |
---|---|
static int |
ACTIVATE
The Activate event type
|
static int |
ARM
The Arm event type
|
static int |
DISARM
The Disarm event type
|
Constructor and Description |
---|
IlvButtonInteractor()
Creates a new
IlvButtonInteractor . |
Modifier and Type | Method and Description |
---|---|
boolean |
processEvent(IlvGraphic obj,
AWTEvent event,
IlvObjectInteractorContext context)
Processes the events.
|
Get, handleExpose, onEnter, onExit, Put
public static final int ARM
public static final int DISARM
public static final int ACTIVATE
public IlvButtonInteractor()
IlvButtonInteractor
.
You should not use the constructor to create an instance,
you may share instances of this interactor
by using the IlvObjectInteractor.Get
method.public boolean processEvent(IlvGraphic obj, AWTEvent event, IlvObjectInteractorContext context)
processEvent
in class IlvObjectInteractor
obj
- The graphic object.event
- The event to process.context
- The context in which the event occurred.true
if the event was handled
by this processEvent
invocation,
false
otherwise.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.