Eclipse Rich Ajax Platform
Release 1.3

org.eclipse.swt.widgets
Class Canvas

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.eclipse.swt.widgets.Composite
                  extended byorg.eclipse.swt.widgets.Canvas
All Implemented Interfaces:
Adaptable, Drawable
Direct Known Subclasses:
CLabel, Decorations, FileUpload

public class Canvas
extends Composite

Instances of this class provide a surface for drawing arbitrary graphics.

Styles:
(none)
Events:
(none)

This class may be subclassed by custom control implementors who are building controls that are not constructed from aggregates of other controls. That is, they are either painted using SWT graphics calls or are handled by native methods.

Since:
1.0
See Also:
Composite

Constructor Summary
Canvas(Composite parent, int style)
          Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
 
Method Summary
 void addPaintListener(PaintListener listener)
          Adds the listener to the collection of listeners who will be notified when the receiver needs to be painted, by sending it one of the messages defined in the PaintListener interface.
 Object getAdapter(Class adapter)
          Implementation of the Adaptable interface.
 void removePaintListener(PaintListener listener)
          Removes the listener from the collection of listeners who will be notified when the receiver needs to be painted.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addTouchListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCursor, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setSize, setSize, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, reskin, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Canvas

public Canvas(Composite parent,
              int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

Parameters:
parent - a composite control which will be the parent of the new instance (cannot be null)
style - the style of control to construct
Throws:
IllegalArgumentException -
SWTException -
See Also:
SWT, Widget.checkSubclass(), Widget.getStyle()
Method Detail

getAdapter

public Object getAdapter(Class adapter)
Implementation of the Adaptable interface.

IMPORTANT: This method is not part of the RWT public API. It is marked public only so that it can be shared within the packages provided by RWT. It should never be accessed from application code.

Specified by:
getAdapter in interface Adaptable
Overrides:
getAdapter in class Composite

addPaintListener

public void addPaintListener(PaintListener listener)
Adds the listener to the collection of listeners who will be notified when the receiver needs to be painted, by sending it one of the messages defined in the PaintListener interface.

Parameters:
listener - the listener which should be notified
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
Since:
1.3
See Also:
PaintListener, removePaintListener(org.eclipse.swt.events.PaintListener)

removePaintListener

public void removePaintListener(PaintListener listener)
Removes the listener from the collection of listeners who will be notified when the receiver needs to be painted.

Parameters:
listener - the listener which should no longer be notified
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
Since:
1.3
See Also:
PaintListener, addPaintListener(org.eclipse.swt.events.PaintListener)

Eclipse Rich Ajax Platform
Release 1.3

Copyright (c) Innoopract Informationssysteme GmbH and others 2002, 2011. All rights reserved.