Modifier and Type | Field and Description |
---|---|
protected SerializableLock |
deviceLock |
Constructor and Description |
---|
Device() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkDevice()
Throws an
SWTException if the receiver can not
be accessed by the caller. |
protected void |
destroy()
Destroys the device .
|
void |
dispose()
Disposes of the operating system resources associated with
the receiver.
|
Rectangle |
getBounds()
Returns a rectangle describing the receiver's size and location.
|
Rectangle |
getClientArea()
Returns a rectangle which describes the area of the receiver which is
capable of displaying data.
|
int |
getDepth()
Returns the bit depth of the screen, which is the number of
bits it takes to represent the number of unique colors that
the screen is currently capable of displaying.
|
Point |
getDPI()
Returns a point whose x coordinate is the horizontal
dots per inch of the display, and whose y coordinate
is the vertical dots per inch of the display.
|
FontData[] |
getFontList(java.lang.String faceName,
boolean scalable)
Returns
FontData objects which describe
the fonts that match the given arguments. |
Color |
getSystemColor(int id)
Returns the matching standard color for the given
constant, which should be one of the color constants
specified in class
SWT . |
Font |
getSystemFont()
Returns a reasonable font for applications to use.
|
boolean |
isDisposed()
Returns
true if the device has been disposed,
and false otherwise. |
protected void |
release()
Releases any internal resources .
|
public Color getSystemColor(int id)
SWT
. Any value other
than one of the SWT color constants which is passed
in will result in the color black. This color should
not be free'd because it was allocated by the system,
not the application.id
- the color constantSWTException
- SWT
public Font getSystemFont()
Typically, applications which want the default look should simply not set the font on the widgets they create. Widgets are always created with the correct default font for the class of user-interface component they represent.
SWTException
- public FontData[] getFontList(java.lang.String faceName, boolean scalable)
FontData
objects which describe
the fonts that match the given arguments. If the
faceName
is null, all fonts will be returned.faceName
- the name of the font to look for, or nullscalable
- if true only scalable fonts are returned, otherwise only non-scalable fonts are returned.SWTException
- public Rectangle getClientArea()
SWTException
- getBounds()
public int getDepth()
SWTException
- public Point getDPI()
SWTException
- public Rectangle getBounds()
SWTException
- public void dispose()
true
when sent the message
isDisposed()
.release()
,
destroy()
,
checkDevice()
public boolean isDisposed()
true
if the device has been disposed,
and false
otherwise.
This method gets the dispose state for the device. When a device has been disposed, it is an error to invoke any other method using the device.
true
when the device is disposed and false
otherwiseprotected void release()
When a device is destroyed, resources that were acquired
on behalf of the programmer need to be returned to the
operating system. For example, if the device allocated a
font to be used as the system font, this font would be
freed in release
. Also,to assist the garbage
collector and minimize the amount of memory that is not
reclaimed when the programmer keeps a reference to a
disposed device, all fields except the handle are zero'd.
The handle is needed by destroy
.
destroy
.
If subclasses reimplement this method, they must
call the super
implementation.
protected void destroy()
This method is called after release
.
Subclasses are supposed to reimplement this method and not
call the super
implementation.
protected void checkDevice()
SWTException
if the receiver can not
be accessed by the caller. This may include both checks on
the state of the receiver and more generally on the entire
execution context. This method should be called by
device implementors to enforce the standard SWT invariants.
Currently, it is an error to invoke any method (other than
isDisposed()
and dispose()
) on a
device that has had its dispose()
method called.
In future releases of SWT, there may be more or fewer error checks and exceptions may be thrown for different reasons.
SWTException
-
Copyright (c) EclipseSource and others 2002, 2020.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0