org.freehep.swing.graphics
Class PointSelectionPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.freehep.swing.graphics.GraphicalSelectionPanel
org.freehep.swing.graphics.PointSelectionPanel
- All Implemented Interfaces:
- Accessible, EventListener, ImageObserver, KeyListener, MenuContainer, MouseListener, MouseMotionListener, Serializable
- public class PointSelectionPanel
- extends GraphicalSelectionPanel
This panel allows the user to select a point on the screen. The
crosshair cursor fill follow the system pointer when the left mouse
button is pressed. The system pointer will become invisible while
the user is actively repositioning the crosshair.
This panel will also respond to keystroke input.
- 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).
- enter key: accept selection region (send off region
selected event)
Normally, the arrow keys move the cursor by 2 pixels per key
release; however if the shift key is pressed simultaneously,
then the arrow keys move the cursor by 1 pixel.
- Version:
- $Id: PointSelectionPanel.java,v 1.7 2001/04/03 10:25:37 loomis Exp $
- Author:
- Charles Loomis
- See Also:
- Serialized Form
- Source Code:
- PointSelectionPanel.java
Methods inherited from class org.freehep.swing.graphics.GraphicalSelectionPanel |
addActionEntry, addActionEntry, addGraphicalSelectionListener, cancelPopupProcessing, fireGraphicalSelectionMade, getBorder, getPopupMenu, isProcessingPopup, keyPressed, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, removeGraphicalSelectionListener, setBorder, setBounds, setSelectionActionsEnabled, testPopupTrigger |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
PointSelectionPanel
public PointSelectionPanel()
- Construct a PointSelectionPanel. Initially the cursor is not
visible.
keyReleased
public void keyReleased(KeyEvent e)
- Process key-released events. This allow the selection panel to
move the cursor with the keyboard arrows.
- 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 (next component made visible).
- enter key: accept selection region (send off region
selected event)
- spacebar: accept selection region (send off region
selected event)
Normally, the arrow keys move the cursor by 2 pixels per key
release; however if the shift key is pressed simultaneously,
then the arrow keys move the cursor by 1 pixel.
- Specified by:
keyReleased
in interface KeyListener
- Overrides:
keyReleased
in class GraphicalSelectionPanel
- Parameters:
e
- KeyEvent describing the key which has been released
mousePressed
public void mousePressed(MouseEvent e)
- The crosshair cursor will begin to follow the system pointer;
the system pointer is made invisible.
- Specified by:
mousePressed
in interface MouseListener
- Overrides:
mousePressed
in class GraphicalSelectionPanel
- Parameters:
e
- the mouse pressed event to which to respond
mouseReleased
public void mouseReleased(MouseEvent e)
- The crosshair cursor will stop following the system pointer
when the mouse is released. The system pointer will again be
visible.
- Specified by:
mouseReleased
in interface MouseListener
- Overrides:
mouseReleased
in class GraphicalSelectionPanel
- Parameters:
e
- the mouse release event to which to respond
mouseDragged
public void mouseDragged(MouseEvent e)
- The crosshair cursor follows the system pointer during a mouse
drag event.
- Specified by:
mouseDragged
in interface MouseMotionListener
- Overrides:
mouseDragged
in class GraphicalSelectionPanel
- Parameters:
e
- the mouse drag event to which to respond
updatePosition
public void updatePosition(int x,
int y)
- This method updates the position of the crosshair cursor.
Normally this is called internally; however, it can be called
programatically by other object, for example, to move the
cursor on top of a selected object.
- Parameters:
x
- the x coordinate for the cursor (in pixels in the
PointSelectionPanel's coordinate system)y
- the y coordinate for the cursor (in pixels in the
PointSelectionPanel's coordinate system)
setCursorVisible
public void setCursorVisible(boolean visible)
- Set the visiblility of the crosshair cursor.
- Parameters:
visible
- boolean indicating whether or not the crosshair
cursor should be visible
getCursorVisible
public boolean getCursorVisible()
- Get the visibility of the crosshair cursor.
- Returns:
- boolean indicating whether or not the crosshair cursor
is visible
resetSelection
public void resetSelection()
- Reset the selection; this remove the crosshair cursor from the
screen.
- Overrides:
resetSelection
in class GraphicalSelectionPanel
paintComponent
public void paintComponent(Graphics g)
makeAffineTransform
public AffineTransform makeAffineTransform()
- Make the affine transform which will center the display on the
current point if applied.
- Returns:
- AffineTransform will center the current point
makeSelectionEvent
protected void makeSelectionEvent(int actionCode)
- A utility function which creates an appropriate selection event
when the user accepts the current selection.
- Overrides:
makeSelectionEvent
in class GraphicalSelectionPanel
Copyright © 2000-2004 FreeHEP, All Rights Reserved.