FreeHEP API
Version current

org.freehep.swing.graphics
Class ParallelogramSelectionPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.freehep.swing.graphics.GraphicalSelectionPanel
                      extended byorg.freehep.swing.graphics.AbstractRegionSelectionPanel
                          extended byorg.freehep.swing.graphics.ParallelogramSelectionPanel
All Implemented Interfaces:
Accessible, EventListener, ImageObserver, KeyListener, MenuContainer, MouseListener, MouseMotionListener, Serializable

public class ParallelogramSelectionPanel
extends AbstractRegionSelectionPanel

Selects a screen region shaped like a parallelogram.

Version:
$Id: ParallelogramSelectionPanel.java,v 1.8 2001/03/05 13:42:39 duns Exp $
Author:
Charles Loomis, Mark Donszelmann
See Also:
Serialized Form
Source Code:
ParallelogramSelectionPanel.java

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class org.freehep.swing.graphics.AbstractRegionSelectionPanel
activeCtrlPt, ctrlPtSize, hitThreshold, lastDrawnRect, lastDrawnRectValid, nCtrlPts, NO_CONTROL_POINT, rectToDraw, updateRect, visible, visibleGuides, xCtrlPts, yCtrlPts
 
Fields inherited from class org.freehep.swing.graphics.GraphicalSelectionPanel
actionMap, defaultModeAction, nextAction, previousAction, selectionActions, thickStroke, thinStroke
 
Fields inherited from class javax.swing.JComponent
accessibleContext, TOOL_TIP_TEXT_KEY, ui, 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
ParallelogramSelectionPanel()
          Creates a ParallelogramSelectionPanel.
 
Method Summary
 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.
 int getNumberOfControlPoints()
          The number of control points is 6 for the parallelogram.
 void initializeControlPoints(int x, int y)
          Initialize the control points for this selection given the initial starting point (x,y).
 boolean isValidSelection()
          Returns a boolean indicating whether or not the selected region is valid.
 AffineTransform makeAffineTransform()
          Make the affine transform which corresponds to this paralleogram-shaped selection.
 void paintComponent(Graphics g)
          Repaint this component.
 void updateActiveControlPoint(int x, int y)
          Move the active control point to the point (x,y).
 
Methods inherited from class org.freehep.swing.graphics.AbstractRegionSelectionPanel
compassCursor, forceXCoordinateWithinBounds, forceYCoordinateWithinBounds, getVisibleGuides, keyReleased, makeOutlinePolygon, makeSelectionEvent, makeTransform, mouseDragged, mouseMoved, mousePressed, mouseReleased, moveActiveControlPoint, nearWhichControlPoint, repaintPanel, resetSelection, setVisibleGuides
 
Methods inherited from class org.freehep.swing.graphics.GraphicalSelectionPanel
addActionEntry, addActionEntry, addGraphicalSelectionListener, cancelPopupProcessing, fireGraphicalSelectionMade, getBorder, getPopupMenu, isProcessingPopup, keyPressed, keyTyped, mouseClicked, mouseEntered, mouseExited, removeGraphicalSelectionListener, setBorder, setBounds, setSelectionActionsEnabled, testPopupTrigger
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParallelogramSelectionPanel

public ParallelogramSelectionPanel()
Creates a ParallelogramSelectionPanel.

Method Detail

getNumberOfControlPoints

public int getNumberOfControlPoints()
The number of control points is 6 for the parallelogram. The four corners and two at the centerpoints of the first and last sides.

Specified by:
getNumberOfControlPoints in class AbstractRegionSelectionPanel
Returns:
6 the number of control points

getControlPointCursor

public Cursor getControlPointCursor(int index)
Description copied from class: AbstractRegionSelectionPanel
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. Return of null will not change the cursor. Subclasses should override this method to provide a default cursor and/or to provide cursors for the different control points.

Overrides:
getControlPointCursor in class AbstractRegionSelectionPanel

initializeControlPoints

public void initializeControlPoints(int x,
                                    int y)
Initialize the control points for this selection given the initial starting point (x,y).

Specified by:
initializeControlPoints in class AbstractRegionSelectionPanel
Parameters:
x - the initial x-coordinate
y - the initial y-coordinate

updateActiveControlPoint

public void updateActiveControlPoint(int x,
                                     int y)
Move the active control point to the point (x,y).

Specified by:
updateActiveControlPoint in class AbstractRegionSelectionPanel
Parameters:
x - x-coordinate of the new point
y - y-coordinate of the new point

paintComponent

public void paintComponent(Graphics g)
Repaint this component.

Overrides:
paintComponent in class AbstractRegionSelectionPanel
Parameters:
g - Graphics context in which to draw

makeAffineTransform

public AffineTransform makeAffineTransform()
Make the affine transform which corresponds to this paralleogram-shaped selection.

Specified by:
makeAffineTransform in class AbstractRegionSelectionPanel
Returns:
AffineTransform which describes the selected region

isValidSelection

public boolean isValidSelection()
Returns a boolean indicating whether or not the selected region is valid. It is valid only if the region has a non-zero area.

Specified by:
isValidSelection in class AbstractRegionSelectionPanel
Returns:
flag indicating whether the region is valid

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.