FreeHEP API
Version current

org.freehep.swing.graphics
Class SquareSelectionPanel

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

public class SquareSelectionPanel
extends AbstractRegionSelectionPanel

A panel which selects a "square" region on the screen. The definition of "square" is that this region will retain the relative scaling of the x and y-axes.

Version:
$Id: SquareSelectionPanel.java,v 1.8 2001/03/05 13:42:40 duns Exp $
Author:
Charles Loomis, Mark Donszelmann
See Also:
Serialized Form
Source Code:
SquareSelectionPanel.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
SquareSelectionPanel()
          Creates a SquareSelectionPanel.
 
Method Summary
 Cursor getControlPointCursor(int index)
          Returns the NE, SE, NW and SW cursors for the four different directions and SquareCursor as the default
 int getNumberOfControlPoints()
          Return the number of control points,5---the four corners and one point in the center of the square.
 void initializeControlPoints(int x, int y)
          Initialize the control points based on the starting point (x,y).
 boolean isValidSelection()
          Determine if the selection is valid; regions of zero area are considered invalid.
 AffineTransform makeAffineTransform()
          Make the affine transform which corresponds to this "square" 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

SquareSelectionPanel

public SquareSelectionPanel()
Creates a SquareSelectionPanel.

Method Detail

getNumberOfControlPoints

public int getNumberOfControlPoints()
Return the number of control points,5---the four corners and one point in the center of the square.

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

getControlPointCursor

public Cursor getControlPointCursor(int index)
Returns the NE, SE, NW and SW cursors for the four different directions and SquareCursor as the default

Overrides:
getControlPointCursor in class AbstractRegionSelectionPanel

initializeControlPoints

public void initializeControlPoints(int x,
                                    int y)
Initialize the control points based on the starting point (x,y).

Specified by:
initializeControlPoints in class AbstractRegionSelectionPanel
Parameters:
x - x-coordinate of starting point
y - y-coordinate of 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 "square" selection.

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

isValidSelection

public boolean isValidSelection()
Determine if the selection is valid; regions of zero area are considered invalid.

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.