org.omegahat.Graphics.Devices
Class GuiOutputDevice

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--org.omegahat.Graphics.Devices.GuiOutputDevice
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, OutputDevice, java.io.Serializable, SimpleGraphicalContainerInt
Direct Known Subclasses:
BoxWhiskersCanvas

public class GuiOutputDevice
extends java.awt.Canvas
implements OutputDevice

Graphics device that displays its contents using a Java AWT component.

A device object from this class has both a graphical object (the contents of the display) and a Java Graphics2d object to do the actual plotting. The class extends Canvas to give access to the range of interaction and control provided by Java's AWT and Swing packages.

See Also:
Serialized Form

Inner classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  java.awt.Graphics2D gc
          The graphics context or pen for drawing on the device.
protected  GraphicalComponentInt go
          The top of the hierarchy or tree.
 
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
GuiOutputDevice()
           
 
Method Summary
 void addGraphicalObject(GraphicalComponentInt go)
           
 void drawIcon(javax.swing.Icon icon, double x, double y, double width, double height)
           
 void drawLines(double[] x, double[] y)
           
 void drawOval(double x, double y, double width, double height)
           
 void drawPolygon(double[] x, double[] y)
           
 void drawPolyline(double[] x, double[] y)
           
 void drawRectangle(double x, double y, double width, double height)
           
 void drawText(java.lang.String s, double x, double y, double rx, double ry, int fontSize, double angle)
           
 void fillOval(double x, double y, double width, double height)
           
 void fillRectangle(double x, double y, double width, double height)
           
 java.awt.Graphics2D gc()
           
 java.awt.Graphics2D gc(java.awt.Graphics2D g)
           
 GraphicalComponentInt go()
           
 GraphicalComponentInt go(GraphicalComponentInt g)
           
 void paint(java.awt.Graphics g)
           
 SimpleGraphicalContainerInt parent()
          Get the parent of this container.
 SimpleGraphicalContainerInt parent(SimpleGraphicalContainerInt p)
          Set the parent of this container.
 boolean popParameters(GraphicsParameters p)
           
 GraphicsParameters pushParameters(GraphicsParameters p)
           
 boolean setParameters(AWTParameters p, AWTParameters diff)
           
 boolean setParameters(GraphicsParameters p, GraphicsParameters diff)
           
 double stringHeight(java.lang.String s)
           
 double stringWidth(java.lang.String s)
           
 void updateGraphics()
           
 
Methods inherited from class java.awt.Canvas
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.omegahat.Graphics.Devices.OutputDevice
repaint
 

Field Detail

gc

protected java.awt.Graphics2D gc
The graphics context or pen for drawing on the device.

go

protected GraphicalComponentInt go
The top of the hierarchy or tree.
Constructor Detail

GuiOutputDevice

public GuiOutputDevice()
Method Detail

drawLines

public void drawLines(double[] x,
                      double[] y)
Specified by:
drawLines in interface OutputDevice

drawPolyline

public void drawPolyline(double[] x,
                         double[] y)
Specified by:
drawPolyline in interface OutputDevice

drawPolygon

public void drawPolygon(double[] x,
                        double[] y)
Specified by:
drawPolygon in interface OutputDevice

drawIcon

public void drawIcon(javax.swing.Icon icon,
                     double x,
                     double y,
                     double width,
                     double height)
Specified by:
drawIcon in interface OutputDevice

drawOval

public void drawOval(double x,
                     double y,
                     double width,
                     double height)
Specified by:
drawOval in interface OutputDevice

fillOval

public void fillOval(double x,
                     double y,
                     double width,
                     double height)
Specified by:
fillOval in interface OutputDevice

drawRectangle

public void drawRectangle(double x,
                          double y,
                          double width,
                          double height)
Specified by:
drawRectangle in interface OutputDevice

fillRectangle

public void fillRectangle(double x,
                          double y,
                          double width,
                          double height)
Specified by:
fillRectangle in interface OutputDevice

drawText

public void drawText(java.lang.String s,
                     double x,
                     double y,
                     double rx,
                     double ry,
                     int fontSize,
                     double angle)
Specified by:
drawText in interface OutputDevice

stringWidth

public double stringWidth(java.lang.String s)
Specified by:
stringWidth in interface OutputDevice

stringHeight

public double stringHeight(java.lang.String s)
Specified by:
stringHeight in interface OutputDevice

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Canvas

addGraphicalObject

public void addGraphicalObject(GraphicalComponentInt go)
Specified by:
addGraphicalObject in interface OutputDevice

setParameters

public boolean setParameters(GraphicsParameters p,
                             GraphicsParameters diff)
Specified by:
setParameters in interface OutputDevice

pushParameters

public GraphicsParameters pushParameters(GraphicsParameters p)
Specified by:
pushParameters in interface OutputDevice

popParameters

public boolean popParameters(GraphicsParameters p)
Specified by:
popParameters in interface OutputDevice

setParameters

public boolean setParameters(AWTParameters p,
                             AWTParameters diff)

gc

public java.awt.Graphics2D gc()

gc

public java.awt.Graphics2D gc(java.awt.Graphics2D g)

go

public GraphicalComponentInt go()

go

public GraphicalComponentInt go(GraphicalComponentInt g)

updateGraphics

public void updateGraphics()

parent

public SimpleGraphicalContainerInt parent()
Description copied from interface: SimpleGraphicalContainerInt
Get the parent of this container.
Specified by:
parent in interface SimpleGraphicalContainerInt

parent

public SimpleGraphicalContainerInt parent(SimpleGraphicalContainerInt p)
Description copied from interface: SimpleGraphicalContainerInt
Set the parent of this container.
Specified by:
parent in interface SimpleGraphicalContainerInt