|
||||||||||
| 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
jfig.canvas.FigSwingCanvas
basic object canvas to draw FIG objects.
FigSwingCanvas provides a canvas for displaying of FIG objects (subclasses of jfig.objects.FigObject) with zoom, several redraw and animation options. Use this class or a subclass of it as the main drawing canvas for a graphics editor like jfig or the corresponding viewer.
FigSwingCanvas handles mouseDown, mouseMove, mouseDrag, and KeyDown events for automatic panning (via cursor-keys or mouseMoves near the border). Other events are passed to the parent applet.
Drawing into the canvas is done in three steps with an offscreen buffer for the grid and the 'objects' respectively:
Additionally, FigSwingCanvas supports the standard zoom functionality.
| Nested Class Summary | |
class |
FigSwingCanvas.Options2D
Options2D: inner class to encapsulate access to Java2D rendering hints in a Java 1.1 compatible way. |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
protected java.awt.Color |
backgroundColor
|
protected int |
BASE_ANCHOR_X
|
protected int |
BASE_ANCHOR_Y
|
protected FigCanvasListener |
canvasListener
|
protected int |
cur_height
|
protected int |
cur_width
|
protected int |
cur_x
|
protected int |
cur_y
|
protected boolean |
debug
|
protected java.awt.Color |
defaultColor
|
java.awt.Cursor |
defaultCursor
|
protected boolean |
enableTimingInfo
|
protected java.awt.Color |
gridColor
|
(package private) int |
gridMode
|
(package private) boolean |
gridVisible
|
protected boolean |
hasRulers
|
protected StatusMessage |
helper
|
protected boolean |
Jdebug
|
protected int |
mode
|
(package private) int |
mouse_drag_x
|
(package private) int |
mouse_drag_y
|
(package private) int |
n_grid
|
(package private) int |
n_redraws
|
(package private) int |
n_trials_to_create_offscreenImage
|
(package private) int |
n_updates
|
protected FigDrawableEnumerator |
objectEnumerator
|
protected java.awt.Graphics |
objectGR
|
protected java.awt.Graphics |
offscreenGR
|
protected java.awt.Image |
offscreenImage
|
protected int |
old_x
|
protected int |
old_y
|
static int |
PAINT_ALL
|
static int |
PAINT_CURSOR
|
static int |
PAINT_NO_CHANGES
|
static int |
PAINT_OBJECTS
|
static int |
PAINT_RIGHT_RULER
|
static int |
PAINT_RUBBERBAND
|
static int |
PAINT_TMP_TEXT
|
static int |
PAINT_TOP_RULER
|
protected ConsoleMessage |
printer
|
protected java.awt.Point |
ptmp
|
protected FigCanvasRubberband |
rubberband
|
protected int |
RULER_XL_OFFSET
|
protected int |
RULER_XR_OFFSET
|
protected int |
RULER_YB_OFFSET
|
protected int |
RULER_YT_OFFSET
|
protected static java.awt.Font |
rulerFont
|
(package private) long |
t_delay
|
(package private) long |
t_grid
|
(package private) long |
t_grid_mean
|
(package private) long |
t_redraw
|
(package private) long |
t_redraw_mean
|
protected java.awt.image.ImageObserver |
theObserver
|
protected java.awt.Point |
tmp_sc
|
protected java.awt.Point |
tmp_wc
|
protected FigTrafo2D |
trafo
|
protected java.awt.Image |
tripleBuffer
|
protected java.awt.Graphics |
tripleBufferGR
|
protected boolean |
useTripleBuffering
|
java.awt.Cursor |
waitCursor
|
protected java.awt.Dimension |
XXX
|
protected java.util.Vector |
zoomListenerVector
|
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface jfig.canvas.FigCanvas |
FullRedraw, MouseMotionRedraw, NoChanges, ObjectRedraw, panDOWN, panHOME, panLEFT, panRIGHT, panUP, SyncRedraw, SystemRedraw, TmpObjectRedraw, TmpTextRedraw |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
FigSwingCanvas()
The FigSwingCanvas public contructor. |
|
| Method Summary | |
void |
addCanvasListener(FigCanvasListener listener)
|
void |
addZoomListener(ZoomListener zl)
|
void |
blitOffscreenBuffer(java.awt.Graphics g)
|
void |
blitOffscreenBufferClipped(java.awt.Graphics g)
|
void |
blitTripleBuffer(java.awt.Graphics g)
|
boolean |
canvasSizeChanged()
|
void |
changeRubberbandMode(int new_mode)
changeRubberbandMode(): change the current mode of our rubberband |
void |
changeRubberbandMode(int mode,
FigTrafo2D t,
java.lang.Object b)
|
void |
changeRubberbandMode(int new_mode,
GeometryManager gm)
|
void |
clearBuffer(java.awt.Graphics g)
clear the Image before drawing the rulers and the grid itself. |
void |
clippedDrawTmpObject(java.awt.Graphics g)
NOTE: this method is currently not used anywhere; and it is possibly broken. |
void |
doFullRedraw()
doFullRedraw(): redraw everything... |
void |
doFullRedraw(long millis)
|
void |
doMotionRedraw()
|
void |
doObjectRedraw()
|
void |
doPanning(int direction,
boolean shift)
automatic panning of the visible viewport on the world-coordinate system. |
void |
doSimpleRedraw()
repaint the canvas under the assumption that at most the temporary FIG objects have changed. |
void |
doSyncRedraw()
method stub for synchronous repaints: FigSwingCanvas itself just provides a doSimpleRedraw(). |
void |
doSystemRedraw()
|
void |
doTextRedraw()
|
void |
doToggleRubberbandDebug()
|
void |
doZoom11()
restore to zoom-factor 1 and origin (0,0) |
void |
doZoomFit()
doZoomFit(): calculate the bounding box of all objects from our FigDrawableEnumerator, then set the zoom and panning so that all objects are visible. |
void |
doZoomFull()
restore to zoom factor 1 |
void |
doZoomIn()
zoom in by a factor of two. |
void |
doZoomIn14()
|
void |
doZoomOut()
try to halve the current zoom factor (if possible), then redraw all. |
void |
doZoomOut07()
|
void |
doZoomRegion(int wx,
int wy,
int wx2,
int wy2)
doZoomRegion(): zoom into the world coordinate region given by corners (wx,wy) and (wx2, wy2). |
void |
drawAllObjects(java.awt.Graphics g)
drawAllObjects(): This traverses the parent's object list and draws all objects marked visible. |
void |
drawGrid(java.awt.Graphics gridGR)
Actually draw the grid, assuming that the offscreenBuffers are already created and of the right size. |
void |
drawGridByHand(java.awt.Graphics gridGR)
This is the "naive" implementation of drawGrid, which actually draws all N*N grid points by individual calls to drawRect. |
void |
drawObject(java.awt.Graphics g,
FigObject object)
draw the specified object. |
void |
drawRulers(java.awt.Graphics g)
drawRulers: draw the scale rulers on top and the right side of the canvas. |
void |
drawSliders(java.awt.Graphics g,
boolean erase)
draw the sliders to mark the current position. |
void |
drawSlidersAndCursor(java.awt.Graphics g,
boolean erase)
draw the sliders in the rulers and the cursor. |
void |
drawSlidersOnce(java.awt.Graphics g,
int x,
int y)
drawSlidersOnce: internal helper function to draw the sliders/cross-hatch at position (x,y). |
void |
drawTmpObjects(java.awt.Graphics g)
|
void |
drawTriangles(java.awt.Graphics g,
int xmax,
int ymax)
draw the 'scrollbar triangles' |
void |
eraseObject(java.awt.Graphics g,
FigObject object)
erase the specified object. |
java.awt.Color |
getBackground()
|
java.awt.Component |
getComponent()
return the AWT/Swing component that actually implements the canvas |
void |
getCurrentCanvasSize()
get the current FigSwingCanvas dimensions and store in our instance vars cur_width and cur_height. |
boolean |
getDebug()
|
java.awt.Color |
getGridColor()
|
java.awt.Point |
getMousePosition()
|
FigDrawableEnumerator |
getObjectEnumerator()
|
java.awt.Graphics |
getOffscreenGraphics()
return a reference to the offscreen Graphics when double-buffering |
FigSwingCanvas.Options2D |
getOptions2D()
|
java.lang.String |
getSwingRepaintMode()
|
FigTrafo2D |
getTrafo()
return the current coordinate transformation used for this canvas. |
java.awt.Point |
getViewportWCmax()
return the world coordinates of the right-bottom corner of this canvas (depending on it's size and the zoom-factor). |
FigBbox |
getVisibleRegionBoundingBox()
|
boolean |
gotFocus()
|
void |
handleRedraw(java.awt.Graphics g)
The handleRedraw method is defined in the FigCanvas interface, but is only exposing details of the inner workings of FigBasicCanvas. |
void |
initializeOffscreenBuffers()
update the offscreen buffer images. |
boolean |
isDoubleBuffered()
we do not want that Swing should manage a double buffer for us. |
boolean |
isManagingFocus()
|
boolean |
isOpaque()
returns true. |
boolean |
isOptimizedDrawingEnabled()
returns true. |
boolean |
isRightYRuler()
if rulers are enabled, should the Y ruler be drawn on the right side (true) or on the left side (false) of this canvas? |
static void |
main(java.lang.String[] argv)
main(): simple self test of FigSwingCanvas inside a Frame. |
void |
mouseClicked(java.awt.event.MouseEvent evt)
|
void |
mouseDragged(java.awt.event.MouseEvent evt)
Handle MouseDrag events: Currently, mouseDrag events are used for canvas panning. |
void |
mouseEntered(java.awt.event.MouseEvent evt)
mouseEntered(): request the keyboard focus. |
void |
mouseExited(java.awt.event.MouseEvent evt)
|
void |
mouseMoved(java.awt.event.MouseEvent evt)
Handle mouseMove events: update sliders/cross hatch, provide rubberbanding Note that we don't need to synchronize in the Swing world: everything is executed in the event dispatcher thread Also note that we have to correct the clip rectangle for the cursor extension (currently three pixels...) |
void |
mousePressed(java.awt.event.MouseEvent evt)
Handle mouseDown events: snap to the currently active grid, then call the parent mouseDown action function. |
void |
mouseReleased(java.awt.event.MouseEvent evt)
mouseReleased() is used to detect mouseDrag() events. |
void |
msg(java.lang.String msg)
print messages to console window or stdout |
void |
notifyZoomListeners()
|
void |
paint(FigDrawable obj)
a method that allows animated objects to update their current state. |
void |
paint(FigDrawable obj,
int millis)
repaint an (animated) object within millis milliseconds. |
void |
paint(java.awt.Graphics g)
dispatches to paintComponent(). |
void |
paintAllObjects(java.awt.Graphics g)
repaint the canvas after update the offscreen buffer. |
void |
paintBorder(java.awt.Graphics g)
does nothing. |
void |
paintComponent(java.awt.Graphics g)
paint this FigSwingCanvas including grid, rulers, objects, rubberband. |
void |
paintCursor(java.awt.Graphics g)
|
void |
paintImmediately(int x,
int y,
int w,
int h)
dispatches to JComponent.paintImmediately(). |
void |
paintNoChanges(java.awt.Graphics g)
repaint the canvas under the assumption that the visible FIG objects have not changed. |
void |
paintRubberband(java.awt.Graphics g)
|
void |
paintTmpText(java.awt.Graphics g)
|
void |
printTimingStats()
|
void |
processKeyEvent(java.awt.event.KeyEvent ko)
|
void |
removeZoomListener(ZoomListener zl)
|
void |
repaint(int millis)
request a standard repaint after (at most) millis milliseconds. |
void |
requestAntiAliasing(boolean b)
|
void |
requestRenderQuality(boolean b)
|
void |
setBackground(java.awt.Color c)
|
void |
setConsole(ConsoleMessage printer)
set the message console |
void |
setDebug(boolean debug)
|
void |
setDefaultCursor(java.awt.Cursor c)
|
void |
setGrid(int gridMode)
set a new grid spacing. |
void |
setGridColor(java.awt.Color c)
set new grid color |
void |
setObjectEnumerator(FigDrawableEnumerator enumerator)
specify the object that will provide this canvas with the Enumeration of drawable objects. |
void |
setRubberbandAspect(double d)
|
void |
setRubberbandBasePoint(int sx,
int sy)
|
void |
setRubberbandBasePoint(java.awt.Point sp)
set a new base point for the rubberband |
void |
setRubberbandBasePoint2(int sx,
int sy)
|
void |
setRubberbandBasePoint2(java.awt.Point P)
|
void |
setRubberbandShowLineLengths(boolean b)
|
void |
setRulerOffsets()
calculate the offsets required when using rulers on this canvas. |
void |
setStatusMessage(StatusMessage helper)
|
void |
setTrafo(FigTrafo2D trafo)
set the coordinate transformation for this canvas. |
void |
setTripleBuffering(boolean b)
|
void |
showRulers(boolean b)
|
void |
statusMessage(java.lang.String msg)
show or print status msgs |
void |
synchronousRepaint()
request a synchronous repaint of all pending animation repaints. |
void |
update(java.awt.Graphics g)
|
| 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, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isLightweightComponent, isMaximumSizeSet, isMinimumSizeSet, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintChildren, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateUI |
| 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, 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, 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 |
| Methods inherited from interface jfig.canvas.FigCanvas |
getCursor, getSize, setCursor |
| Field Detail |
protected FigDrawableEnumerator objectEnumerator
protected FigTrafo2D trafo
protected ConsoleMessage printer
protected StatusMessage helper
protected FigCanvasListener canvasListener
protected java.util.Vector zoomListenerVector
public java.awt.Cursor waitCursor
public java.awt.Cursor defaultCursor
protected FigCanvasRubberband rubberband
protected java.awt.image.ImageObserver theObserver
protected java.awt.Image offscreenImage
protected java.awt.Image tripleBuffer
protected java.awt.Graphics offscreenGR
protected java.awt.Graphics objectGR
protected java.awt.Graphics tripleBufferGR
protected int cur_x
protected int cur_y
protected int old_x
protected int old_y
protected int cur_width
protected int cur_height
protected java.awt.Dimension XXX
protected java.awt.Point ptmp
protected java.awt.Point tmp_sc
protected java.awt.Point tmp_wc
protected java.awt.Color backgroundColor
protected java.awt.Color gridColor
protected java.awt.Color defaultColor
protected static final java.awt.Font rulerFont
boolean gridVisible
int gridMode
public static final int PAINT_TMP_TEXT
public static final int PAINT_NO_CHANGES
public static final int PAINT_TOP_RULER
public static final int PAINT_RIGHT_RULER
public static final int PAINT_CURSOR
public static final int PAINT_RUBBERBAND
public static final int PAINT_OBJECTS
public static final int PAINT_ALL
protected int mode
protected int BASE_ANCHOR_X
protected int BASE_ANCHOR_Y
protected int RULER_XL_OFFSET
protected int RULER_XR_OFFSET
protected int RULER_YT_OFFSET
protected int RULER_YB_OFFSET
int mouse_drag_x
int mouse_drag_y
protected boolean hasRulers
protected boolean debug
protected boolean Jdebug
protected boolean enableTimingInfo
protected boolean useTripleBuffering
int n_updates
int n_redraws
long t_redraw
long t_redraw_mean
int n_grid
long t_grid
long t_grid_mean
long t_delay
int n_trials_to_create_offscreenImage
| Constructor Detail |
public FigSwingCanvas()
| Method Detail |
public java.lang.String getSwingRepaintMode()
public void setRulerOffsets()
FigCanvas
setRulerOffsets in interface FigCanvaspublic boolean isRightYRuler()
public void setDebug(boolean debug)
setDebug in interface FigCanvaspublic boolean getDebug()
getDebug in interface FigCanvaspublic FigTrafo2D getTrafo()
FigCanvas
getTrafo in interface FigCanvaspublic void setTrafo(FigTrafo2D trafo)
FigCanvas
setTrafo in interface FigCanvaspublic java.awt.Component getComponent()
FigCanvas
getComponent in interface FigCanvaspublic java.awt.Graphics getOffscreenGraphics()
FigCanvas
getOffscreenGraphics in interface FigCanvaspublic void setDefaultCursor(java.awt.Cursor c)
setDefaultCursor in interface FigCanvaspublic void addCanvasListener(FigCanvasListener listener)
addCanvasListener in interface FigCanvaspublic void setObjectEnumerator(FigDrawableEnumerator enumerator)
setObjectEnumerator in interface FigCanvaspublic FigDrawableEnumerator getObjectEnumerator()
getObjectEnumerator in interface FigCanvaspublic void statusMessage(java.lang.String msg)
statusMessage in interface FigCanvaspublic void setStatusMessage(StatusMessage helper)
setStatusMessage in interface FigCanvaspublic void msg(java.lang.String msg)
msg in interface FigCanvaspublic void setConsole(ConsoleMessage printer)
setConsole in interface FigCanvaspublic void setBackground(java.awt.Color c)
setBackground in interface FigCanvaspublic void setGridColor(java.awt.Color c)
setGridColor in interface FigCanvaspublic java.awt.Color getBackground()
getBackground in interface FigCanvaspublic java.awt.Color getGridColor()
getGridColor in interface FigCanvaspublic java.awt.Point getMousePosition()
getMousePosition in interface FigCanvaspublic void showRulers(boolean b)
showRulers in interface FigCanvaspublic void setTripleBuffering(boolean b)
public void mousePressed(java.awt.event.MouseEvent evt)
mousePressed in interface FigCanvaspublic void mouseReleased(java.awt.event.MouseEvent evt)
If both the current and the previous mouse_drag_(x,y) position lie in the rulers and differ by more than 5 pixels (to suppress small 'jitter'), we calculate the corresponding viewport panning.
In the future, we should probably provide some kind of visual feedback about the current drag amout by using mouseDrag() to update the rulers correspondingly.
mouseReleased in interface FigCanvaspublic void mouseEntered(java.awt.event.MouseEvent evt)
mouseEntered in interface FigCanvaspublic void mouseExited(java.awt.event.MouseEvent evt)
mouseExited in interface FigCanvaspublic void mouseClicked(java.awt.event.MouseEvent evt)
mouseClicked in interface FigCanvaspublic void mouseMoved(java.awt.event.MouseEvent evt)
mouseMoved in interface FigCanvaspublic void mouseDragged(java.awt.event.MouseEvent evt)
However, mouseDrag() at the moment is not used: The actual panning calculations are done in mouseUp(). We should probably provide visual feedback about the drag amout by redrawing the rulers in this function.
mouseDragged in interface FigCanvaspublic boolean gotFocus()
gotFocus in interface FigCanvas
public void doPanning(int direction,
boolean shift)
doPanning in interface FigCanvaspublic boolean isDoubleBuffered()
public boolean isOptimizedDrawingEnabled()
public boolean isOpaque()
public boolean isManagingFocus()
public void processKeyEvent(java.awt.event.KeyEvent ko)
public void paint(java.awt.Graphics g)
paint in interface FigCanvaspublic void paintBorder(java.awt.Graphics g)
public void paintImmediately(int x,
int y,
int w,
int h)
public void paintComponent(java.awt.Graphics g)
The current rendering algorithm is as follows: 1. We first check whether the current canvas size still agrees with our offscreen buffer size. If not, we have to re-create the offscreen buffer and set the PAINT_ALL mode. 2. If the PAINT_ALL mode is set, e.g. as a result of doFullRedraw() or a window resize, we update the offscreen buffer first. This consists of drawing the grid, all FIG objects, and the tmp FIG objects onto the background buffer. 3. We bitblt the offscreen buffer onto the screen. 4. We draw the rulers, rubberband, and cursor on the screen.
Note: Experiments with all current JDKs (1.3+, 1.4+) from Sun, Blackdown, and IBM show that the Graphics XOR-mode rendering does not work reliably, especially for font rendering. (to say the least). Therefore, the redraw cannot use the (potentially) much faster XOR-mode based rubberbanding, but always has to do a bitblt with subsequent overdraw...
public void paintNoChanges(java.awt.Graphics g)
public void paintCursor(java.awt.Graphics g)
public void paintRubberband(java.awt.Graphics g)
public void paintTmpText(java.awt.Graphics g)
public void paintAllObjects(java.awt.Graphics g)
public void paint(FigDrawable obj)
paint in interface FigCanvas
public void paint(FigDrawable obj,
int millis)
paint in interface FigCanvaspublic void repaint(int millis)
repaint in interface FigCanvaspublic void synchronousRepaint()
synchronousRepaint in interface FigCanvaspublic void update(java.awt.Graphics g)
update in interface FigCanvaspublic void drawTmpObjects(java.awt.Graphics g)
drawTmpObjects in interface FigCanvaspublic void clippedDrawTmpObject(java.awt.Graphics g)
clippedDrawTmpObject in interface FigCanvaspublic void blitTripleBuffer(java.awt.Graphics g)
public void blitOffscreenBuffer(java.awt.Graphics g)
blitOffscreenBuffer in interface FigCanvaspublic void blitOffscreenBufferClipped(java.awt.Graphics g)
blitOffscreenBufferClipped in interface FigCanvaspublic void printTimingStats()
printTimingStats in interface FigCanvaspublic void doFullRedraw()
doFullRedraw in interface FigCanvaspublic void doFullRedraw(long millis)
doFullRedraw in interface FigCanvaspublic void doSimpleRedraw()
doSimpleRedraw in interface FigCanvaspublic void doTextRedraw()
doTextRedraw in interface FigCanvaspublic void doObjectRedraw()
doObjectRedraw in interface FigCanvaspublic void doMotionRedraw()
doMotionRedraw in interface FigCanvaspublic void doSystemRedraw()
doSystemRedraw in interface FigCanvaspublic void doSyncRedraw()
This method should be overridden by subclasses as necessary.
doSyncRedraw in interface FigCanvaspublic void handleRedraw(java.awt.Graphics g)
handleRedraw in interface FigCanvas
public void eraseObject(java.awt.Graphics g,
FigObject object)
eraseObject in interface FigCanvas
public void drawObject(java.awt.Graphics g,
FigObject object)
drawObject in interface FigCanvas
public void drawSlidersAndCursor(java.awt.Graphics g,
boolean erase)
drawSlidersAndCursor in interface FigCanvas
public void drawSlidersOnce(java.awt.Graphics g,
int x,
int y)
public void drawSliders(java.awt.Graphics g,
boolean erase)
public final java.awt.Point getViewportWCmax()
getViewportWCmax in interface FigCanvaspublic FigBbox getVisibleRegionBoundingBox()
getVisibleRegionBoundingBox in interface FigCanvaspublic void drawAllObjects(java.awt.Graphics g)
drawAllObjects in interface FigCanvasg - the graphics-context to draw into (e.g. the FigCanvas
screen or the offscreenImage buffer).public void setGrid(int gridMode)
This function implies a full redraw, in order to generate the new grid.
setGrid in interface FigCanvaspublic void drawRulers(java.awt.Graphics g)
public void drawTriangles(java.awt.Graphics g,
int xmax,
int ymax)
public void getCurrentCanvasSize()
public void initializeOffscreenBuffers()
In order to run jfig both as an applet or standalone application, we have to be a little cautious here: While the applet's browser will be visible, it will provide us with a working graphics context. The standalone application will only receive a graphics context, when its frame is fully constructed and finally visible. As we need some graphics context, before we can proceed to build the offscreen buffer images, this implies that we have to wait until the editor frame window is already show()ing.
I consider this to be a bad Java JDK-10 bug, but it may be a feature :-)
public boolean canvasSizeChanged()
public void clearBuffer(java.awt.Graphics g)
public void drawGrid(java.awt.Graphics gridGR)
gridGR - the Graphics for drawing.public void drawGridByHand(java.awt.Graphics gridGR)
public void doZoomFit()
FigCanvas
doZoomFit in interface FigCanvaspublic void doZoomOut()
doZoomOut in interface FigCanvaspublic void doZoomIn()
doZoomIn in interface FigCanvaspublic void doZoomFull()
doZoomFull in interface FigCanvaspublic void doZoom11()
doZoom11 in interface FigCanvas
public void doZoomRegion(int wx,
int wy,
int wx2,
int wy2)
doZoomRegion in interface FigCanvaspublic void doZoomIn14()
public void doZoomOut07()
public void addZoomListener(ZoomListener zl)
addZoomListener in interface FigCanvaspublic void removeZoomListener(ZoomListener zl)
removeZoomListener in interface FigCanvaspublic void notifyZoomListeners()
notifyZoomListeners in interface FigCanvaspublic final void changeRubberbandMode(int new_mode)
changeRubberbandMode in interface FigCanvas
public final void changeRubberbandMode(int new_mode,
GeometryManager gm)
changeRubberbandMode in interface FigCanvas
public final void changeRubberbandMode(int mode,
FigTrafo2D t,
java.lang.Object b)
changeRubberbandMode in interface FigCanvaspublic final void setRubberbandBasePoint(java.awt.Point sp)
setRubberbandBasePoint in interface FigCanvas
public final void setRubberbandBasePoint(int sx,
int sy)
setRubberbandBasePoint in interface FigCanvaspublic final void setRubberbandBasePoint2(java.awt.Point P)
setRubberbandBasePoint2 in interface FigCanvas
public final void setRubberbandBasePoint2(int sx,
int sy)
setRubberbandBasePoint2 in interface FigCanvaspublic final void setRubberbandAspect(double d)
setRubberbandAspect in interface FigCanvaspublic void doToggleRubberbandDebug()
doToggleRubberbandDebug in interface FigCanvaspublic void setRubberbandShowLineLengths(boolean b)
setRubberbandShowLineLengths in interface FigCanvaspublic void requestRenderQuality(boolean b)
requestRenderQuality in interface FigCanvaspublic void requestAntiAliasing(boolean b)
requestAntiAliasing in interface FigCanvaspublic FigSwingCanvas.Options2D getOptions2D()
public static void main(java.lang.String[] argv)
throws java.lang.Exception
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||