|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.swt.widgets.Canvas
public class Canvas
Instances of this class provide a surface for drawing arbitrary graphics.
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.
Composite
,
Canvas snippets,
SWT Example: ControlExample,
Sample code and further informationField Summary |
---|
Fields inherited from class org.eclipse.swt.widgets.Composite |
---|
embeddedHandle |
Fields inherited from class org.eclipse.swt.widgets.Widget |
---|
handle |
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 |
drawBackground(GC gc,
int x,
int y,
int width,
int height)
Fills the interior of the rectangle specified by the arguments, with the receiver's background. |
Caret |
getCaret()
Returns the caret. |
IME |
getIME()
Returns the IME. |
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. |
void |
setCaret(Caret caret)
Sets the receiver's caret. |
void |
setFont(Font font)
Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null. |
void |
setIME(IME ime)
Sets the receiver's IME. |
Methods inherited from class org.eclipse.swt.widgets.Composite |
---|
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList |
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
---|
computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar |
Methods inherited from class org.eclipse.swt.widgets.Widget |
---|
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, 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 |
Constructor Detail |
---|
public Canvas(Composite parent, int style)
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.
parent
- a composite control which will be the parent of the new instance (cannot be null)style
- the style of control to construct
java.lang.IllegalArgumentException
- SWTException
- SWT
,
Widget.checkSubclass()
,
Widget.getStyle()
Method Detail |
---|
public void drawBackground(GC gc, int x, int y, int width, int height)
gc
- the gc where the rectangle is to be filledx
- the x coordinate of the rectangle to be filledy
- the y coordinate of the rectangle to be filledwidth
- the width of the rectangle to be filledheight
- the height of the rectangle to be filled
java.lang.IllegalArgumentException
- SWTException
- public Caret getCaret()
The caret for the control is automatically hidden and shown when the control is painted or resized, when focus is gained or lost and when an the control is scrolled. To avoid drawing on top of the caret, the programmer must hide and show the caret when drawing in the window any other time.
SWTException
- public IME getIME()
SWTException
- public void scroll(int destX, int destY, int x, int y, int width, int height, boolean all)
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
SWTException
- public void setCaret(Caret caret)
The caret for the control is automatically hidden and shown when the control is painted or resized, when focus is gained or lost and when an the control is scrolled. To avoid drawing on top of the caret, the programmer must hide and show the caret when drawing in the window any other time.
caret
- the new caret for the receiver, may be null
java.lang.IllegalArgumentException
- SWTException
- public void setFont(Font font)
Control
setFont
in class Control
font
- the new font (or null)public void setIME(IME ime)
ime
- the new IME for the receiver, may be null
java.lang.IllegalArgumentException
- SWTException
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |