|
|||||||||
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.Font
public final class 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
,
Font snippets,
SWT Examples: GraphicsExample, PaintExample,
Sample code and further informationField Summary | |
---|---|
long |
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,
FontData[] fds)
Constructs a new font given a device and an array of font data which describes the desired font's appearance. |
|
Font(Device device,
java.lang.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 | |
---|---|
boolean |
equals(java.lang.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. |
static Font |
gtk_new(Device device,
long handle)
Invokes platform specific functionality to allocate a new font. |
int |
hashCode()
Returns an integer hash code for the receiver. |
boolean |
isDisposed()
Returns true if the font has been disposed,
and false otherwise. |
java.lang.String |
toString()
Returns a string containing a concise, human-readable description of the receiver. |
Methods inherited from class org.eclipse.swt.graphics.Resource |
---|
dispose, getDevice |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public long handle
IMPORTANT: This field is not part of the SWT public API. 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 accessed from application code.
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)
java.lang.IllegalArgumentException
- SWTError
- public Font(Device device, FontData[] fds)
You must dispose the font when it is no longer required.
device
- the device to create the font onfds
- the array of FontData that describes the desired font (must not be null)
java.lang.IllegalArgumentException
- SWTError
- public Font(Device device, java.lang.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
java.lang.IllegalArgumentException
- SWTError
- Method Detail |
---|
public boolean equals(java.lang.Object object)
equals
in class java.lang.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 static Font gtk_new(Device device, long 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 fontpublic int hashCode()
true
when passed to
equals
must return the same value for this
method.
hashCode
in class java.lang.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.
isDisposed
in class Resource
true
when the font is disposed and false
otherwisepublic java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |