Class DrawArea

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--DrawArea
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable

class DrawArea
extends java.awt.Canvas
implements java.lang.Runnable

The DrawArea class the part of the Lissa application draws the Lissajous figures.

It works as an animator with double buffering.

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, java.awt.Component.AWTTreeLock
 
Field Summary
(package private) static int dx
           
(package private) static int dy
           
(package private) static int ldx
           
(package private) static int ldy
           
(package private) static int maxDelta
           
 
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DrawArea(java.awt.Dimension daSize, DebugArea da)
          Constructs a new DrawArea and sets its initial values to their defaults.
 
Method Summary
 Pix getAmp()
          Returns amplitude values.
 Pix getFreq()
          Returns frequency values.
 Pix getPhase()
          Returns phase values.
 void paint(java.awt.Graphics g)
          Painting function.
 void reset()
          Reset the drawing with initial time constant.
 void reset(double i)
          Reset the drawing with given time constant.
 void run()
          Animator run function.
 void setAmp(double a1, double a2)
          Set amplitudes according to two given double values.
 void setAmp(Pix amp)
          Set amplitudes according to given Pix
 void setFreq(double f1, double f2)
          Set frequencies according to two given double values.
 void setFreq(Pix freq)
          Set frequencies according to given Pix
 void setINC()
          Set time constant to its initial value.
 void setINC(double i)
          Set time constant.
 void setPhase(double p1, double p2)
          Set phases according to two given double values.
 void setPhase(Pix phase)
          Set phases according to given Pix
 void setSize(java.awt.Dimension daSize)
          Set size of this DrawArea
 void start()
          Animator start function.
 void stop()
          Animator stop function.
 java.lang.String toString()
          Returns a String that represents the state of this DrawArea.
 void update(java.awt.Graphics g)
          Update override.
 
Methods inherited from class java.awt.Canvas
, addNotify, constructComponentName, getAccessibleContext, postsOldMouseEvents
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkGD, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createChildHierarchyEvents, createHierarchyEvents, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPaint, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, numListening, paintAll, paintHeavyweightComponents, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, printHeavyweightComponents, 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, resetGC, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setVisible, show, show, size, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ldx

static int ldx

ldy

static int ldy

dx

static int dx

dy

static int dy

maxDelta

static int maxDelta
Constructor Detail

DrawArea

public DrawArea(java.awt.Dimension daSize,
                DebugArea da)
Constructs a new DrawArea and sets its initial values to their defaults.
Parameters:
daSize - initial size of drawing area
da - DebugArea used to output debug information, should be set up by parent object
Method Detail

setFreq

public void setFreq(Pix freq)
Set frequencies according to given Pix
Parameters:
freq - Pix containing new frequency values

setFreq

public void setFreq(double f1,
                    double f2)
Set frequencies according to two given double values.
Parameters:
f1 - new x-axis frequency value
f2 - new y-axis frequency value

setPhase

public void setPhase(Pix phase)
Set phases according to given Pix
Parameters:
phase - Pix containing new phase values

setPhase

public void setPhase(double p1,
                     double p2)
Set phases according to two given double values.
Parameters:
p1 - new x-axis phase value
p2 - new y-axis phase value

setAmp

public void setAmp(Pix amp)
Set amplitudes according to given Pix
Parameters:
amp - Pix containing new amplitude values

setAmp

public void setAmp(double a1,
                   double a2)
Set amplitudes according to two given double values.
Parameters:
a1 - new x-axis amplitude value
a2 - new y-axis amplitude value

getFreq

public Pix getFreq()
Returns frequency values.
Returns:
current frequency values

getPhase

public Pix getPhase()
Returns phase values.
Returns:
current phase values

getAmp

public Pix getAmp()
Returns amplitude values.
Returns:
current amplitude values

setSize

public void setSize(java.awt.Dimension daSize)
Set size of this DrawArea
Overrides:
setSize in class java.awt.Component
Parameters:
daSize - new DrawArea size

reset

public void reset()
Reset the drawing with initial time constant.

reset

public void reset(double i)
Reset the drawing with given time constant. Stop applet, reset all values and start the applet again.
Parameters:
i - new time constant

setINC

public void setINC(double i)
Set time constant.
Parameters:
i - new time constant

setINC

public void setINC()
Set time constant to its initial value.

update

public void update(java.awt.Graphics g)
Update override. Its not wanted to clear the output every frame.
Overrides:
update in class java.awt.Component

paint

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

stop

public void stop()
Animator stop function.

start

public void start()
Animator start function.

run

public void run()
Animator run function.
Specified by:
run in interface java.lang.Runnable

toString

public java.lang.String toString()
Returns a String that represents the state of this DrawArea.
Overrides:
toString in class java.awt.Component
Returns:
a string containing relevant information of the current DrawArea state