|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.eclipse.swt.graphics.GC
Class GC is where all of the drawing capabilities that are
supported by SWT are located. Instances are used to draw on either an
Image, a Control, or directly on a Display.
Application code must explicitly invoke the GC.dispose()
method to release the operating system resources managed by each instance
when those instances are no longer required. This is particularly
important on Windows95 and Windows98 where the operating system has a limited
number of device contexts available.
Note: Only one of LEFT_TO_RIGHT and RIGHT_TO_LEFT may be specified.
org.eclipse.swt.events.PaintEvent| Constructor Summary | |
GC(Drawable drawable)
Constructs a new instance of this class which has been configured to draw on the specified drawable. |
|
| Method Summary | |
void |
dispose()
Disposes of the operating system resources associated with the graphics context. |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draws a line, using the foreground color, between the points ( x1, y1) and (x2, y2). |
void |
drawRectangle(int x,
int y,
int w,
int h)
Draws the outline of the rectangle specified by the arguments, using the receiver's foreground color. |
void |
drawText(String string,
int x,
int y,
int flags)
Draws the given string, using the receiver's current font and foreground color. |
void |
fillRectangle(int x,
int y,
int w,
int h)
Fills the interior of the rectangle specified by the arguments, using the receiver's background color. |
boolean |
isDisposed()
Returns true if the GC has been disposed,
and false otherwise.
|
void |
setBackground(Color color)
Sets the background color. |
void |
setForeground(Color color)
Sets the foreground color. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, toString |
| Constructor Detail |
public GC(Drawable drawable)
You must dispose the graphics context when it is no longer required.
drawable - the drawable to draw on
IllegalArgumentException - SWTError - | Method Detail |
public void dispose()
public void drawLine(int x1,
int y1,
int x2,
int y2)
x1, y1) and (x2, y2).
x1 - the first point's x coordinatey1 - the first point's y coordinatex2 - the second point's x coordinatey2 - the second point's y coordinate
SWTException -
public void drawRectangle(int x,
int y,
int w,
int h)
x and x + width.
The top and bottom edges are at y and y + height.
x - the x coordinate of the rectangle to be drawny - the y coordinate of the rectangle to be drawnw - the width of the rectangle to be drawnh - the height of the rectangle to be drawn
SWTException -
public void fillRectangle(int x,
int y,
int w,
int h)
x - the x coordinate of the rectangle to be filledy - the y coordinate of the rectangle to be filledw - the width of the rectangle to be filledh - the height of the rectangle to be filled
SWTException - drawRectangle(int, int, int, int)public boolean isDisposed()
true if the GC has been disposed,
and false otherwise.
This method gets the dispose state for the GC. When a GC has been disposed, it is an error to invoke any other method using the GC.
true when the GC is disposed and false otherwisepublic void setBackground(Color color)
color - the new background color for the receiver
IllegalArgumentException - SWTException - public void setForeground(Color color)
color - the new foreground color for the receiver
IllegalArgumentException - SWTException -
public void drawText(String string,
int x,
int y,
int flags)
flags includes DRAW_TRANSPARENT,
then the background of the rectangular area where the text is being
drawn will not be modified, otherwise it will be filled with the
receiver's background color.
The parameter flags may be a combination of:
string - the string to be drawnx - the x coordinate of the top left corner of the rectangular area where the text is to be drawny - the y coordinate of the top left corner of the rectangular area where the text is to be drawnflags - the flags specifing how to process the text
IllegalArgumentException - SWTException -
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||