|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.swt.graphics.Font
Instances of this class manage operating system resources that
define how text looks when it is displayed. Fonts may be constructed
by providing a device and either name, size and style information
or a FontData
object which encapsulates this data.
Application code must explicitly invoke the Font.dispose()
method to release the operating system resources managed by each instance
when those instances are no longer required.
FontData
Field Summary | |
int |
handle
the handle to the OS font resource (Warning: This field is platform dependent) |
Constructor Summary | |
Font(Device device,
FontData fd)
Constructs a new font given a device and font data which describes the desired font's appearance. |
|
Font(Device device,
String name,
int height,
int style)
Constructs a new font given a device, a font name, the height of the desired font in points, and a font style. |
Method Summary | |
void |
dispose()
Disposes of the operating system resources associated with the font. |
boolean |
equals(Object object)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. |
FontData[] |
getFontData()
Returns an array of FontData s representing the receiver. |
int |
hashCode()
Returns an integer hash code for the receiver. |
boolean |
isDisposed()
Returns true if the font has been disposed,
and false otherwise. |
String |
toString()
Returns a string containing a concise, human-readable description of the receiver. |
static Font |
win32_new(Device device,
int handle)
Invokes platform specific functionality to allocate a new font. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public int handle
Constructor Detail |
public Font(Device device, FontData fd)
You must dispose the font when it is no longer required.
device
- the device to create the font onfd
- the FontData that describes the desired font (must not be null)
IllegalArgumentException
- SWTError
- public Font(Device device, String name, int height, int style)
You must dispose the font when it is no longer required.
device
- the device to create the font onname
- the name of the font (must not be null)height
- the font height in pointsstyle
- a bit or combination of NORMAL, BOLD, ITALIC
IllegalArgumentException
- SWTError
- Method Detail |
public void dispose()
public boolean equals(Object object)
equals
in class Object
object
- the object to compare with this object
true
if the object is the same as this object and false
otherwisehashCode()
public FontData[] getFontData()
FontData
s representing the receiver.
On Windows, only one FontData will be returned per font. On X however,
a Font
object may be composed of multiple X
fonts. To support this case, we return an array of font data objects.
SWTException
- public int hashCode()
true
when passed to
equals
must return the same value for this
method.
hashCode
in class Object
equals(java.lang.Object)
public boolean isDisposed()
true
if the font has been disposed,
and false
otherwise.
This method gets the dispose state for the font. When a font has been disposed, it is an error to invoke any other method using the font.
true
when the font is disposed and false
otherwisepublic String toString()
toString
in class Object
public static Font win32_new(Device device, int handle)
IMPORTANT: This method is not part of the public
API for Font
. It is marked public only so that it
can be shared within the packages provided by SWT. It is not
available on all platforms, and should never be called from
application code.
device
- the device on which to allocate the colorhandle
- the handle for the font
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |