|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.omegahat.Graphics.Plots.Examples.Events.SelectionTracker
Example of how we listen to graphics device
events and identify the graphical components
identified by those events,
supporting either clicking on a point
or brushing a region.
The simple click identifies the
component at the pointer for the click javax.swing.event.
The brushing provides a rubber-band rectangle
while the dragging is occurring.
Terminiating the drag calls the
getSelected()
method which currently returns an array containing
| Field Summary | |
protected java.awt.Graphics |
gc
Graphics context used in the drawing of the rubber band. |
protected boolean |
justClicks
Indicates whether we are interested in click or brushing/dragging event. |
protected javax.swing.ListSelectionModel |
selectionModel
|
protected int |
x0
The starting location in pixels (RDC) of the latest rubber-banding. |
protected int |
x1
The other location of the rubber-banding rectangle. |
protected int |
y0
The starting location in pixels (RDC) of the latest rubber-banding. |
protected int |
y1
The other location of the rubber-banding rectangle. |
| Constructor Summary | |
SelectionTracker(java.awt.Component comp)
|
|
SelectionTracker(java.awt.Component comp,
boolean justClicks)
|
|
| Method Summary | |
int[] |
getSelected(int x0,
int y0,
int x1,
int y1,
GraphicalContainerInt top,
java.awt.Rectangle bounds)
Current method for identifying the graphical components in the graphical container that are in the rectangle identified by the device coordinates x0, y0, x1, y1. |
javax.swing.ListSelectionModel |
getSelectionModel()
Accessor for selectionModel field |
GraphicalComponentInt |
identify(java.awt.event.MouseEvent ev)
Identify the graphical component in the data region of the plot in the AWT component reporting the mouse event. |
void |
mouseClicked(java.awt.event.MouseEvent e)
If we are just interested in clicks, this is called when there is a simple mouse click (not drag and release) and then we determine which graphical component data region of interest has been selected by this point. |
void |
mouseDragged(java.awt.event.MouseEvent e)
Triggered when the mouse is dragged in the device of interest, causing us to move the rubber banding rectangle and update its position. |
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Need to implement this, but not interested in simple motion - only drags. |
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent ev)
|
javax.swing.ListSelectionModel |
setSelectionModel(javax.swing.ListSelectionModel value)
Accessor for setting selectionModel field |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected boolean justClicks
protected java.awt.Graphics gc
protected int x0
protected int y0
protected int x1
protected int y1
protected javax.swing.ListSelectionModel selectionModel
| Constructor Detail |
public SelectionTracker(java.awt.Component comp)
public SelectionTracker(java.awt.Component comp,
boolean justClicks)
| Method Detail |
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent ev)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic GraphicalComponentInt identify(java.awt.event.MouseEvent ev)
public int[] getSelected(int x0,
int y0,
int x1,
int y1,
GraphicalContainerInt top,
java.awt.Rectangle bounds)
x0, y0, x1, y1.public javax.swing.ListSelectionModel getSelectionModel()
selectionModel fieldpublic javax.swing.ListSelectionModel setSelectionModel(javax.swing.ListSelectionModel value)
selectionModel field
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||