Class Canvas


  extended by Object
      extended by Component
          extended by Canvas

public class Canvas
extends Component

Canvas is a component which is painted by script. Whenever system wants to paint the contents of Canvas it calls Script.paint(Component, Graphics, Style, int, int) callback, passing the Canvas instance as argument.

A custom paint callback function can be supplied also.

See Also:
Callbacks

Constructor Summary
Canvas(Style style)
          Constructs a new Canvas component.
Canvas(Style style, PaintCallback callback)
          Constructs a new Canvas component with custom paint callback.
 
Method Summary
 
Methods inherited from class Component
add, appendText, clear, find, first, get, getAction, getData, getElement, getFlags, getImage, getLocation, getParent, getShell, getSize, getStyle, getText, getViewPort, hasLinefeed, indexOf, insert, isFocusable, isShown, isVisible, isWrapping, last, operator_get, operator_set, remove, remove, repaint, set, setAction, setData, setElement, setFlags, setImage, setLocation, setPreferredHeight, setPreferredSize, setPreferredWidth, setStyle, setText, size
 
Methods inherited from class Object
toString, equals, hashCode
 
Methods inherited from
equals, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Canvas

public Canvas(Style style)
Constructs a new Canvas component.

Parameters:
style - Style to use

Canvas

public Canvas(Style style,
              PaintCallback callback)
Constructs a new Canvas component with custom paint callback.

It is possible to set a custom paint function as an argument in the constructor. Whenever the system decides to paint the Canvas it will call this function that must match the signature of PaintCallback.paint(Component, Graphics, Style, int, int). If the supplied callback is null the generic function Script.paint(Component, Graphics, Style, int, int) will be called.

Parameters:
style - Style to use
callback - Callback to use or null to use the generic callback