|
||||||||||
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.jhotdraw.standard.StandardDrawingView
org.jhotdraw.contrib.zoom.ZoomDrawingView
public class ZoomDrawingView
A view that can display drawings at an arbitrary scale.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.jhotdraw.standard.StandardDrawingView |
---|
StandardDrawingView.DrawingViewKeyListener, StandardDrawingView.DrawingViewMouseListener, StandardDrawingView.DrawingViewMouseMotionListener |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Field Summary |
---|
Fields inherited from class org.jhotdraw.standard.StandardDrawingView |
---|
MINIMUM_HEIGHT, MINIMUM_WIDTH, SCROLL_INCR, SCROLL_OFFSET |
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 | |
---|---|
ZoomDrawingView(DrawingEditor editor)
|
|
ZoomDrawingView(DrawingEditor editor,
int width,
int height)
|
Method Summary | |
---|---|
void |
deZoom(int x,
int y)
Sets the zoom scale to 1.0 and adjusts the scroll pane so that point (x, y) is in the center. |
void |
drawBackground(java.awt.Graphics g)
Draws the background. |
void |
drawingInvalidated(DrawingChangeEvent e)
Overridden to accumulate damage in an instance variable of this class. |
java.awt.Graphics |
getGraphics()
Gets a graphic to draw into |
java.awt.Dimension |
getMinimumSize()
Gets the minimum dimension of the drawing. |
java.awt.Dimension |
getPreferredSize()
Gets the preferred dimension of the drawing.. |
double |
getScale()
|
java.awt.Dimension |
getSize()
Gets the size of the drawing. |
java.awt.Dimension |
getUserSize()
|
java.awt.Dimension |
getViewportSize()
|
double |
getZoomSpeed()
Returns the current zoom speed |
void |
paint(java.awt.Graphics g)
Paints the drawing view. |
void |
repairDamage()
Overridden to scale damage to screen coordinates. |
void |
setDrawing(Drawing d)
Sets and installs another drawing in the view. |
void |
setOriginPosition(java.awt.Point newOrigin)
Sets the coordinates of the left top corner displayed by the view. |
void |
setUserSize(java.awt.Dimension d)
Sets the size of this view in user coordinates. |
void |
setUserSize(int width,
int height)
Sets the size of this view in user coordinates. |
void |
setZoomSpeed(double newZoomSpeed)
Set the zoom speed. |
void |
zoom(float newScale)
Set this view's scale factor |
void |
zoom(int x,
int y,
int width,
int height)
Readjusts this view and its containing ScrollPane to display the given rectangle, which is given in user coordinates. |
void |
zoomIn(int x,
int y)
InContext Zooms in by a factor of the current scale, keeping point (x,y), which is given in user coordinates, in the center. |
void |
zoomOut(int x,
int y)
Zooms out by a factor of two, keeping point (x,y), which is given in user coordinates, in the center. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jhotdraw.framework.DrawingView |
---|
createImage, getBackground, setBackground |
Methods inherited from interface java.awt.image.ImageObserver |
---|
imageUpdate |
Constructor Detail |
---|
public ZoomDrawingView(DrawingEditor editor)
public ZoomDrawingView(DrawingEditor editor, int width, int height)
Method Detail |
---|
public final double getScale()
public void setUserSize(int width, int height)
public void setUserSize(java.awt.Dimension d)
public java.awt.Dimension getSize()
DrawingView
getSize
in interface DrawingView
getSize
in class java.awt.Component
public java.awt.Dimension getViewportSize()
public void setOriginPosition(java.awt.Point newOrigin)
public java.awt.Dimension getUserSize()
public void zoom(int x, int y, int width, int height)
public void zoom(float newScale)
public void zoomOut(int x, int y)
public void zoomIn(int x, int y)
public void deZoom(int x, int y)
public void paint(java.awt.Graphics g)
DrawingView
paint
in interface DrawingView
paint
in class javax.swing.JComponent
Painter
public java.awt.Graphics getGraphics()
DrawingView
getGraphics
in interface DrawingView
getGraphics
in class javax.swing.JComponent
public void drawBackground(java.awt.Graphics g)
StandardDrawingView
drawBackground
in interface DrawingView
drawBackground
in class StandardDrawingView
public void setDrawing(Drawing d)
StandardDrawingView
setDrawing
in interface DrawingView
setDrawing
in class StandardDrawingView
public java.awt.Dimension getMinimumSize()
StandardDrawingView
getMinimumSize
in interface DrawingView
getMinimumSize
in class StandardDrawingView
StandardDrawingView.getMinimumSize()
,
Component.getMinimumSize()
public java.awt.Dimension getPreferredSize()
DrawingView
getPreferredSize
in interface DrawingView
getPreferredSize
in class javax.swing.JComponent
public void repairDamage()
repairDamage
in interface DrawingView
repairDamage
in class StandardDrawingView
public void drawingInvalidated(DrawingChangeEvent e)
drawingInvalidated
in interface DrawingChangeListener
drawingInvalidated
in class StandardDrawingView
public double getZoomSpeed()
public void setZoomSpeed(double newZoomSpeed)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |