com.vistech.graphics
Class GraphicsCanvas2D

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.vistech.graphics.GraphicsCanvas2D
All Implemented Interfaces:
GraphicsDisplay, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class GraphicsCanvas2D
extends javax.swing.JComponent
implements GraphicsDisplay

A graphics canvas class.

Version:
1.0 11 july 1999
Author:
Lawrence Rodrigues
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  java.awt.Stroke basicStroke
           
protected  int capStyle
           
protected  java.awt.Shape clip
           
protected  java.awt.Shape clipShape
           
protected  java.awt.Composite composite
           
protected  java.awt.Color drawingColor
           
protected  java.awt.Color fillColor
           
protected  java.awt.Font font
           
protected  int fontSize
           
protected  int fontStyle
           
protected  int fontType
           
protected  int height
           
protected  int joinStyle
           
protected  java.awt.Graphics2D offScrGc
           
protected  java.awt.image.BufferedImage offScrImage
           
protected  java.awt.Paint paint
           
protected  java.awt.RenderingHints renderingHints
           
protected  float strokeWidth
           
protected  java.awt.Color textColor
           
protected  int width
           
protected  java.awt.geom.AffineTransform xform
           
 
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.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
GraphicsCanvas2D()
           
 
Method Summary
 void createOffScreenImage(int wid, int ht)
           
 void draw(java.awt.Shape s)
          Draws the specified shape on the destination image
 int getCapStyle()
           
 java.awt.Shape getClip()
           
 java.awt.Composite getComposite()
           
 java.awt.image.BufferedImage getDisplayedImage()
           
 java.awt.Graphics2D getDisplayedImageGC()
           
 java.awt.Color getDrawingColor()
           
 java.awt.Color getFillColor()
           
 java.awt.Font getFont()
           
 int getFontSize()
           
 int getFontStyle()
           
 int getFontType()
           
 int getJoinStyle()
           
 java.awt.Paint getPaint()
           
 java.awt.RenderingHints getRenderingHints()
           
 java.awt.Stroke getStroke()
           
 int getStrokeWidth()
           
 java.awt.Color getTextColor()
           
 java.awt.geom.AffineTransform getTransform()
           
 void paintComponent(java.awt.Graphics g)
           
 void reset()
           
 void setCapStyle(int capStyle)
           
 void setClip(java.awt.Shape clipShape)
          Sets the clip shape on the destination image
 void setComposite(java.awt.Composite composite)
           
 void setDrawingColor(java.awt.Color drawingColor)
           
 void setFillColor(java.awt.Color fillColor)
           
 void setFont(java.awt.Font font)
          Sets the font.
 void setFontSize(int sz)
           
 void setFontStyle(int style)
           
 void setFontType(int type)
           
 void setJoinStyle(int style)
           
 void setPaint(java.awt.Paint paint)
           
 void setRenderingHints(java.awt.RenderingHints renderingHints)
           
 void setStroke(java.awt.Stroke stroke)
           
 void setStrokeWidth(int enum)
           
 void setTextColor(java.awt.Color textColor)
           
 void setTransform(java.awt.geom.AffineTransform transform)
           
 
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, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.vistech.graphics.GraphicsDisplay
addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addVetoableChangeListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, setCursor
 

Field Detail

offScrImage

protected java.awt.image.BufferedImage offScrImage

offScrGc

protected java.awt.Graphics2D offScrGc

clipShape

protected java.awt.Shape clipShape

width

protected int width

height

protected int height

drawingColor

protected java.awt.Color drawingColor

fillColor

protected java.awt.Color fillColor

textColor

protected java.awt.Color textColor

paint

protected java.awt.Paint paint

clip

protected java.awt.Shape clip

xform

protected java.awt.geom.AffineTransform xform

basicStroke

protected java.awt.Stroke basicStroke

renderingHints

protected java.awt.RenderingHints renderingHints

composite

protected java.awt.Composite composite

font

protected java.awt.Font font

strokeWidth

protected float strokeWidth

capStyle

protected int capStyle

joinStyle

protected int joinStyle

fontStyle

protected int fontStyle

fontSize

protected int fontSize

fontType

protected int fontType
Constructor Detail

GraphicsCanvas2D

public GraphicsCanvas2D()
Method Detail

setFontType

public void setFontType(int type)
Specified by:
setFontType in interface GraphicsDisplay

getFontType

public int getFontType()
Specified by:
getFontType in interface GraphicsDisplay

setFontSize

public void setFontSize(int sz)
Specified by:
setFontSize in interface GraphicsDisplay

getFontSize

public int getFontSize()
Specified by:
getFontSize in interface GraphicsDisplay

setFontStyle

public void setFontStyle(int style)
Specified by:
setFontStyle in interface GraphicsDisplay

getFontStyle

public int getFontStyle()
Specified by:
getFontStyle in interface GraphicsDisplay

setFont

public void setFont(java.awt.Font font)
Description copied from interface: GraphicsDisplay
Sets the font.
Specified by:
setFont in interface GraphicsDisplay
Overrides:
setFont in class javax.swing.JComponent
Following copied from interface: com.vistech.graphics.GraphicsDisplay
Parameters:
font - the font.

getFont

public java.awt.Font getFont()
Specified by:
getFont in interface GraphicsDisplay
Overrides:
getFont in class java.awt.Component

setDrawingColor

public void setDrawingColor(java.awt.Color drawingColor)
Specified by:
setDrawingColor in interface GraphicsDisplay

getDrawingColor

public java.awt.Color getDrawingColor()
Specified by:
getDrawingColor in interface GraphicsDisplay

setFillColor

public void setFillColor(java.awt.Color fillColor)
Specified by:
setFillColor in interface GraphicsDisplay

getFillColor

public java.awt.Color getFillColor()
Specified by:
getFillColor in interface GraphicsDisplay

setTextColor

public void setTextColor(java.awt.Color textColor)
Specified by:
setTextColor in interface GraphicsDisplay

getTextColor

public java.awt.Color getTextColor()
Specified by:
getTextColor in interface GraphicsDisplay

setComposite

public void setComposite(java.awt.Composite composite)
Specified by:
setComposite in interface GraphicsDisplay

getComposite

public java.awt.Composite getComposite()
Specified by:
getComposite in interface GraphicsDisplay

setPaint

public void setPaint(java.awt.Paint paint)
Specified by:
setPaint in interface GraphicsDisplay

getPaint

public java.awt.Paint getPaint()
Specified by:
getPaint in interface GraphicsDisplay

setTransform

public void setTransform(java.awt.geom.AffineTransform transform)
Specified by:
setTransform in interface GraphicsDisplay

getTransform

public java.awt.geom.AffineTransform getTransform()
Specified by:
getTransform in interface GraphicsDisplay

setCapStyle

public void setCapStyle(int capStyle)
Specified by:
setCapStyle in interface GraphicsDisplay

getCapStyle

public int getCapStyle()
Specified by:
getCapStyle in interface GraphicsDisplay

setStrokeWidth

public void setStrokeWidth(int enum)
Specified by:
setStrokeWidth in interface GraphicsDisplay

getStrokeWidth

public int getStrokeWidth()
Specified by:
getStrokeWidth in interface GraphicsDisplay

setJoinStyle

public void setJoinStyle(int style)

getJoinStyle

public int getJoinStyle()

setStroke

public void setStroke(java.awt.Stroke stroke)
Specified by:
setStroke in interface GraphicsDisplay

getStroke

public java.awt.Stroke getStroke()
Specified by:
getStroke in interface GraphicsDisplay

setRenderingHints

public void setRenderingHints(java.awt.RenderingHints renderingHints)
Specified by:
setRenderingHints in interface GraphicsDisplay

getRenderingHints

public java.awt.RenderingHints getRenderingHints()
Specified by:
getRenderingHints in interface GraphicsDisplay

draw

public void draw(java.awt.Shape s)
Description copied from interface: GraphicsDisplay
Draws the specified shape on the destination image
Specified by:
draw in interface GraphicsDisplay
Following copied from interface: com.vistech.graphics.GraphicsDisplay
Parameters:
shape - the shape to be drawn

setClip

public void setClip(java.awt.Shape clipShape)
Description copied from interface: GraphicsDisplay
Sets the clip shape on the destination image
Specified by:
setClip in interface GraphicsDisplay
Following copied from interface: com.vistech.graphics.GraphicsDisplay
Parameters:
clipshape - the shape of the clipping area

getClip

public java.awt.Shape getClip()
Specified by:
getClip in interface GraphicsDisplay

getDisplayedImage

public java.awt.image.BufferedImage getDisplayedImage()
Specified by:
getDisplayedImage in interface GraphicsDisplay

getDisplayedImageGC

public java.awt.Graphics2D getDisplayedImageGC()
Specified by:
getDisplayedImageGC in interface GraphicsDisplay

createOffScreenImage

public void createOffScreenImage(int wid,
                                 int ht)

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

reset

public void reset()
Specified by:
reset in interface GraphicsDisplay