FreeHEP API
Version current

org.freehep.swing.graphics
Class RotatedRectangleSelectionPanel

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.RotatedRectangleSelectionPanel
All Implemented Interfaces:
Accessible, EventListener, ImageObserver, KeyListener, MenuContainer, MouseListener, MouseMotionListener, Serializable

public class RotatedRectangleSelectionPanel
extends AbstractRegionSelectionPanel

A panel which selects a rectangular region on the screen which can be arbitrarily rotated.

Version:
$Id: RotatedRectangleSelectionPanel.java,v 1.8 2001/03/05 13:42:39 duns Exp $
Author:
Charles Loomis, Mark Donszelmann
See Also:
Serialized Form
Source Code:
RotatedRectangleSelectionPanel.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
RotatedRectangleSelectionPanel()
          Creates a RotatedRectangleSelectionPanel.
 
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---the four corners and the centerpoints of the first and last sides.
 void initializeControlPoints(int x, int y)
          Initialize the control points given the starting point (x,y).
 boolean isValidSelection()
          Check that the area of the selection is non-zero.
 AffineTransform makeAffineTransform()
          Make the affine transform which corresponds to this rectangular 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

RotatedRectangleSelectionPanel

public RotatedRectangleSelectionPanel()
Creates a RotatedRectangleSelectionPanel.

Method Detail

getNumberOfControlPoints

public int getNumberOfControlPoints()
The number of control points is 6---the four corners and 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 given the starting point (x,y).

Specified by:
initializeControlPoints in class AbstractRegionSelectionPanel
Parameters:
x - x-coordinate of the starting point
y - y-coordinate of the starting point

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)
Description copied from class: AbstractRegionSelectionPanel
Repaint this component. This must be overridden by subclasses so that the selection region appears correctly. The subclass should check the visibility flag (visible) to decide if any painting needs to be done.

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 rectangular selection.

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

isValidSelection

public boolean isValidSelection()
Check that the area of the selection is non-zero.

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

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.