Class MouseEventAdapter
- java.lang.Object
-
- net.sf.jguiraffe.gui.platform.swing.builder.event.SwingEventAdapter
-
- net.sf.jguiraffe.gui.platform.swing.builder.event.MouseEventAdapter
-
- All Implemented Interfaces:
MouseListener
,EventListener
public class MouseEventAdapter extends SwingEventAdapter implements MouseListener
A specific Swing event adapter implementation that deals with mouse events.
- Version:
- $Id: MouseEventAdapter.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description MouseEventAdapter(net.sf.jguiraffe.gui.builder.event.FormEventManager eventManager, net.sf.jguiraffe.gui.forms.ComponentHandler<?> handler, String name)
Creates a new instance ofMouseEventAdapter
that passes the events it receives to theFormEventManager
.MouseEventAdapter(net.sf.jguiraffe.gui.builder.event.FormMouseListener l, net.sf.jguiraffe.gui.forms.ComponentHandler<?> handler, String name)
Creates a new instance ofMouseEventAdapter
that passes the events it receives to the specifiedFormMouseListener
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected net.sf.jguiraffe.gui.builder.event.FormMouseEvent
createEvent(MouseEvent srcEvent, net.sf.jguiraffe.gui.builder.event.FormMouseEvent.Type type)
Creates aFormMouseEvent
from the specified source Swing event using the given event type.protected net.sf.jguiraffe.gui.builder.event.FormListenerType
getListenerType()
Returns theFormListenerType
for this event adapter.void
mouseClicked(MouseEvent event)
Notifies this listener about a mouse entered event.void
mouseEntered(MouseEvent event)
Notifies this listener about a mouse entered event.void
mouseExited(MouseEvent event)
Notifies this listener about a mouse exited event.void
mousePressed(MouseEvent event)
Notifies this listener about a mouse pressed event.void
mouseReleased(MouseEvent event)
Notifies this listener about a mouse released event.-
Methods inherited from class net.sf.jguiraffe.gui.platform.swing.builder.event.SwingEventAdapter
fireEvent, getEventListener, getEventManager, getHandler, getName
-
-
-
-
Constructor Detail
-
MouseEventAdapter
public MouseEventAdapter(net.sf.jguiraffe.gui.builder.event.FormMouseListener l, net.sf.jguiraffe.gui.forms.ComponentHandler<?> handler, String name)
Creates a new instance ofMouseEventAdapter
that passes the events it receives to the specifiedFormMouseListener
.- Parameters:
l
- theFormMouseListener
(must not be null)handler
- theComponentHandler
name
- the name of the component- Throws:
IllegalArgumentException
- if theFormMouseListener
is null
-
MouseEventAdapter
public MouseEventAdapter(net.sf.jguiraffe.gui.builder.event.FormEventManager eventManager, net.sf.jguiraffe.gui.forms.ComponentHandler<?> handler, String name)
Creates a new instance ofMouseEventAdapter
that passes the events it receives to theFormEventManager
.- Parameters:
eventManager
- theFormEventManager
(must not be null)handler
- theComponentHandler
name
- the name of the component- Throws:
IllegalArgumentException
- if theFormEventManager
is null
-
-
Method Detail
-
mouseClicked
public void mouseClicked(MouseEvent event)
Notifies this listener about a mouse entered event. This implementation checks theclickCount
property to find out whether this is a normal click or a double click. This determines the type of the correspondingFormMouseEvent
. Then such aFormMouseEvent
is created and passed to theSwingEventAdapter.fireEvent(net.sf.jguiraffe.gui.builder.event.FormEvent)
method.- Specified by:
mouseClicked
in interfaceMouseListener
- Parameters:
event
- the Swing mouse event
-
mouseEntered
public void mouseEntered(MouseEvent event)
Notifies this listener about a mouse entered event. This implementation creates a correspondingFormMouseEvent
and passes it to theSwingEventAdapter.fireEvent(net.sf.jguiraffe.gui.builder.event.FormEvent)
method.- Specified by:
mouseEntered
in interfaceMouseListener
- Parameters:
event
- the Swing mouse event
-
mouseExited
public void mouseExited(MouseEvent event)
Notifies this listener about a mouse exited event. This implementation creates a correspondingFormMouseEvent
and passes it to theSwingEventAdapter.fireEvent(net.sf.jguiraffe.gui.builder.event.FormEvent)
method.- Specified by:
mouseExited
in interfaceMouseListener
- Parameters:
event
- the Swing mouse event
-
mousePressed
public void mousePressed(MouseEvent event)
Notifies this listener about a mouse pressed event. This implementation creates a correspondingFormMouseEvent
and passes it to theSwingEventAdapter.fireEvent(net.sf.jguiraffe.gui.builder.event.FormEvent)
method.- Specified by:
mousePressed
in interfaceMouseListener
- Parameters:
event
- the Swing mouse event
-
mouseReleased
public void mouseReleased(MouseEvent event)
Notifies this listener about a mouse released event. This implementation creates a correspondingFormMouseEvent
and passes it to theSwingEventAdapter.fireEvent(net.sf.jguiraffe.gui.builder.event.FormEvent)
method.- Specified by:
mouseReleased
in interfaceMouseListener
- Parameters:
event
- the Swing mouse event
-
getListenerType
protected net.sf.jguiraffe.gui.builder.event.FormListenerType getListenerType()
Returns theFormListenerType
for this event adapter. This implementation returns the type for mouse listeners.- Specified by:
getListenerType
in classSwingEventAdapter
- Returns:
- the
FormListenerType
-
createEvent
protected net.sf.jguiraffe.gui.builder.event.FormMouseEvent createEvent(MouseEvent srcEvent, net.sf.jguiraffe.gui.builder.event.FormMouseEvent.Type type)
Creates aFormMouseEvent
from the specified source Swing event using the given event type.- Parameters:
srcEvent
- the source Swing eventtype
- the event type- Returns:
- the new
FormMouseEvent
-
-