|
Eclipse Rich Ajax Platform Release 1.3 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.swt.graphics.Resource
org.eclipse.swt.graphics.GC
Class GC is provided to ease single-sourcing SWT and RWT code.
Its text measurement methods directly delegate to the respective
Graphics methods.
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.
| Constructor Summary | |
GC(Drawable drawable)
Constructs a new instance of this class which has been configured to draw on the specified drawable. |
|
| Method Summary | |
Color |
getBackground()
Returns the background color. |
int |
getCharWidth(char ch)
Returns the width of the specified character in the font selected into the receiver. |
Font |
getFont()
Returns the font currently being used by the receiver to draw and measure text. |
FontMetrics |
getFontMetrics()
Returns a FontMetrics which contains information about the font currently being used by the receiver to draw and measure text. |
Color |
getForeground()
Returns the receiver's foreground color. |
void |
setBackground(Color color)
Sets the background color. |
void |
setFont(Font font)
Sets the font which will be used by the receiver to draw and measure text to the argument. |
void |
setForeground(Color color)
Sets the foreground color. |
Point |
stringExtent(String string)
Returns the extent of the given string. |
Point |
textExtent(String string)
Returns the extent of the given string. |
| Methods inherited from class org.eclipse.swt.graphics.Resource |
dispose, getDevice, isDisposed |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 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 setFont(Font font)
font - the new font for the receiver, or null to indicate a default font
IllegalArgumentException - SWTException - public Font getFont()
SWTException - public int getCharWidth(char ch)
The width is defined as the space taken up by the actual character, not including the leading and tailing whitespace or overhang.
ch - the character to measure
SWTException - public Point stringExtent(String string)
The extent of a string is the width and height of the rectangular area it would cover if drawn in a particular font (in this case, the current font in the receiver).
string - the string to measure
IllegalArgumentException - SWTException - public Point textExtent(String string)
The extent of a string is the width and height of the rectangular area it would cover if drawn in a particular font (in this case, the current font in the receiver).
string - the string to measure
IllegalArgumentException - SWTException - public FontMetrics getFontMetrics()
SWTException - public void setBackground(Color color)
color - the new background color for the receiver
IllegalArgumentException - SWTException - public Color getBackground()
SWTException - public void setForeground(Color color)
color - the new foreground color for the receiver
IllegalArgumentException - SWTException - public Color getForeground()
SWTException -
|
Eclipse Rich Ajax Platform Release 1.3 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Copyright (c) Innoopract Informationssysteme GmbH and others 2002, 2009. All rights reserved.