org.eclipse.swt.widgets
Class Canvas
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.swt.widgets.Canvas
- All Implemented Interfaces:
- Drawable
- Direct Known Subclasses:
- Decorations
- 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.
- 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 |
scroll(int destX,
int destY,
int x,
int y,
int width,
int height,
boolean all)
Scrolls a rectangular area of the receiver by first copying
the source area to the destination and then causing the area
of the source which is not covered by the destination to
be repainted. |
Methods inherited from class org.eclipse.swt.widgets.Control |
addControlListener, addFocusListener, addKeyListener, addMouseListener, addMouseMoveListener, addPaintListener, addTraverseListener, computeSize, computeSize, forceFocus, getBackground, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getParent, getShell, getSize, getToolTipText, getVisible, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setEnabled, setFocus, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update |
Methods inherited from class org.eclipse.swt.widgets.Widget |
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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:
java.lang.IllegalArgumentException
-
- ERROR_NULL_ARGUMENT - if the parent is null
SWTException
-
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- See Also:
SWT
,
Widget.checkSubclass()
,
Widget.getStyle()
scroll
public void scroll(int destX,
int destY,
int x,
int y,
int width,
int height,
boolean all)
- Scrolls a rectangular area of the receiver by first copying
the source area to the destination and then causing the area
of the source which is not covered by the destination to
be repainted. Children that intersect the rectangle are
optionally moved during the operation. In addition, outstanding
paint events are flushed before the source area is copied to
ensure that the contents of the canvas are drawn correctly.
- Parameters:
destX
- the x coordinate of the destinationdestY
- the y coordinate of the destinationx
- the x coordinate of the sourcey
- the y coordinate of the sourcewidth
- the width of the areaheight
- the height of the areaall
- true
if children should be scrolled, and false
otherwise
- Throws:
SWTException
-
- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver