|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.freehep.swing.graphics.GraphicalSelectionPanel
org.freehep.swing.graphics.AbstractRegionSelectionPanel
public abstract class AbstractRegionSelectionPanel
This abstract class defines the majority of the functionality needed to make selections of arbitrary parallelogram regions on the screen.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.BaselineResizeBehavior |
| Field Summary | |
|---|---|
static int |
NO_CONTROL_POINT
A constant which flags that no control point was near the mouse-pressed event. |
| Fields inherited from class javax.swing.JComponent |
|---|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
AbstractRegionSelectionPanel()
This constructor makes a new AbstractRegionSelectionPanel. |
|
| Method Summary | |
|---|---|
static Cursor |
compassCursor(String type,
int dx,
int dy,
int n,
boolean diagonal)
returns the appropriate cursor for any of the compass points. |
int |
forceXCoordinateWithinBounds(int x)
A utility method which forces the x-coordinate to be within the component boundries. |
int |
forceYCoordinateWithinBounds(int y)
A utility method which forces the y-coordinate to be within the component boundries. |
Cursor |
getControlPointCursor(int index)
Returns the Cursor to be displayed for a certain control point and the default cursor for this SelectionPanel for an index of NO_CONTROL_POINT. |
abstract int |
getNumberOfControlPoints()
Useful subclasses must define the number of control points on the selected region. |
boolean |
getVisibleGuides()
Get whether or not the guides are visible. |
abstract void |
initializeControlPoints(int x,
int y)
Initialize the control points. |
abstract boolean |
isValidSelection()
This returns whether the current selected region is valid. |
void |
keyReleased(KeyEvent e)
Process key-released events. |
abstract AffineTransform |
makeAffineTransform()
Make the affine transform which corresponds to this rectangular selection. |
Polygon |
makeOutlinePolygon()
Make the outline of the selection. |
void |
mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged. |
void |
mouseMoved(MouseEvent e)
Changes the active control point according to mouse movements |
void |
mousePressed(MouseEvent e)
Handle the mousePressed events. |
void |
mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component. |
void |
paintComponent(Graphics g)
Repaint this component. |
void |
resetSelection()
Make the selection box invisible. |
void |
setVisibleGuides(boolean visibleGuides)
Determine whether or not to display guide lines. |
abstract void |
updateActiveControlPoint(int x,
int y)
Change the active control point to the point (x,y). |
| Methods inherited from class org.freehep.swing.graphics.GraphicalSelectionPanel |
|---|
addGraphicalSelectionListener, getBorder, getPopupMenu, isProcessingPopup, keyPressed, keyTyped, mouseClicked, mouseEntered, mouseExited, removeGraphicalSelectionListener, setBorder, setBounds |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int NO_CONTROL_POINT
| Constructor Detail |
|---|
public AbstractRegionSelectionPanel()
| Method Detail |
|---|
public void setVisibleGuides(boolean visibleGuides)
public boolean getVisibleGuides()
public void keyReleased(KeyEvent e)
arrow keys: move the active control point in the specified
direction.
backspace key: reset selection region (make invisible).
delete key: reset selection region (make invisible).
escape key: leave selection mode (make component invisible).
tab key: next selection mode (make next component visible).
enter key: accept selection region (send off region selected
event)
spacebar: accept selection region (send off region selected
event)
keyReleased in interface KeyListenerkeyReleased in class GraphicalSelectionPanele - KeyEvent describing the key which has been releasedpublic void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenermouseMoved in class GraphicalSelectionPanele - MouseEvent describing actionpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenermousePressed in class GraphicalSelectionPanele - MouseEvent describing actionpublic int forceXCoordinateWithinBounds(int x)
x - x-coordinate to force within boundries
public int forceYCoordinateWithinBounds(int y)
y - y-coordinate to force within boundries
public void mouseDragged(MouseEvent e)
GraphicalSelectionPanel
mouseDragged in interface MouseMotionListenermouseDragged in class GraphicalSelectionPanele - MouseEvent describing actionpublic void mouseReleased(MouseEvent e)
GraphicalSelectionPanel
mouseReleased in interface MouseListenermouseReleased in class GraphicalSelectionPanele - MouseEvent describing actionpublic abstract boolean isValidSelection()
public void resetSelection()
resetSelection in class GraphicalSelectionPanel
public abstract void initializeControlPoints(int x,
int y)
x - x-coordinate of initial mouse-pressed eventy - y-coordinate of initial mouse-pressed event
public abstract void updateActiveControlPoint(int x,
int y)
x - x-coordinate of the new pointy - y-coordinate of the new pointpublic abstract int getNumberOfControlPoints()
public Cursor getControlPointCursor(int index)
public void paintComponent(Graphics g)
paintComponent in class JComponentg - Graphics context in which to drawpublic Polygon makeOutlinePolygon()
public abstract AffineTransform makeAffineTransform()
public static Cursor compassCursor(String type,
int dx,
int dy,
int n,
boolean diagonal)
type - type of cursor (Resize/Rotation)dx - screen x of directiondy - screen y of direction (positive is down)n - number of compass points (4 or 8)diagonal - in case n = 4, a diagonal compass point is returned
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||