@Deprecated
public final class Graphics
extends java.lang.Object
The class has also been used as a helper class for measuring texts. This can also be done using a GC.
Modifier and Type | Method and Description |
---|---|
static float |
getAvgCharWidth(Font font)
Deprecated.
Application code should not need to use this method. If you need an average
character width, you can use
GC.stringExtent(String) with a string of your
choice and calculate the average width. |
static int |
getCharHeight(Font font)
Deprecated.
Application code should not need to use this method. If you need this information,
you can use
GC.stringExtent(String) with a string of your choice and get
the height of the result. |
static Color |
getColor(int red,
int green,
int blue)
Deprecated.
Factory created resources are obsolete and will be removed in a future release. Use
the constructor
Color(Device, int, int, int) instead. |
static Color |
getColor(RGB rgb)
Deprecated.
Factory created resources are obsolete and will be removed in a future release. Use
the constructor
Color(Device, RGB) instead. |
static Font |
getFont(FontData data)
Deprecated.
Factory created resources are obsolete and will be removed in a future release. Use
the constructor
Font(Device, FontData) instead. |
static Font |
getFont(java.lang.String name,
int height,
int style)
Deprecated.
Factory created resources are obsolete and will be removed in a future release. Use
the constructor
Font(Device, String, int, int) instead. |
static Image |
getImage(java.lang.String path)
Deprecated.
Factory created resources are obsolete and will be removed in a future release. Use
the constructor
Image(Device, InputStream)} instead. |
static Image |
getImage(java.lang.String path,
java.lang.ClassLoader imageLoader)
Deprecated.
Factory created resources are obsolete and will be removed in a future release. Use
the constructor
Image(Device, InputStream)} instead. |
static Image |
getImage(java.lang.String path,
java.io.InputStream inputStream)
Deprecated.
Factory created resources are obsolete and will be removed in a future release. Use
the constructor
Image(Device, InputStream)} instead. |
static Point |
stringExtent(Font font,
java.lang.String string)
Deprecated.
You can use SWT API to measure a string. Create a GC, set the font, and measure the
string using
GC.stringExtent(String) . Don't forget to dispose the GC
afterwards. |
static Point |
textExtent(Font font,
java.lang.String string,
int wrapWidth)
Deprecated.
In most cases, you can use SWT API to measure texts. Create a GC, set the font, and
measure the text using
GC.textExtent(String) . Don't forget to dispose the
GC afterwards. |
@Deprecated public static Color getColor(RGB rgb)
Color(Device, RGB)
instead.Color
given an RGB
describing the desired red,
green and blue values.
Note: it is considered an error to attempt to dispose of colors that were created by this
method. An IllegalStateException
is thrown in this case.
rgb
- the RGB values of the desired color - must not be nulljava.lang.IllegalArgumentException
- RGB
,
Device.getSystemColor(int)
@Deprecated public static Color getColor(int red, int green, int blue)
Color(Device, int, int, int)
instead.Color
given the desired red, green and blue values expressed as ints in the
range 0 to 255 (where 0 is black and 255 is full brightness).
Note: it is considered an error to attempt to dispose of colors that were created by this
method. An IllegalStateException
is thrown in this case.
red
- the amount of red in the colorgreen
- the amount of green in the colorblue
- the amount of blue in the colorjava.lang.IllegalArgumentException
- @Deprecated public static Font getFont(FontData data)
Font(Device, FontData)
instead.
Note: it is considered an error to attempt to dispose of fonts that were created by this
method. An IllegalStateException
is thrown in this case.
data
- the FontData
to use - must not be nulljava.lang.IllegalArgumentException
- @Deprecated public static Font getFont(java.lang.String name, int height, int style)
Font(Device, String, int, int)
instead.Font
object given a font name, the height of the desired font in points, and
a font style.
Note: it is considered an error to attempt to dispose of fonts that were created by this
method. An IllegalStateException
is thrown in this case.
name
- 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
- @Deprecated public static Image getImage(java.lang.String path)
Image(Device, InputStream)} instead.
Image
based on the specified image path. The image has to be on
the applications class-path.path
- the path to the imagejava.lang.IllegalArgumentException
- java.lang.IllegalArgumentException
- SWTException
- @Deprecated public static Image getImage(java.lang.String path, java.lang.ClassLoader imageLoader)
Image(Device, InputStream)} instead.
Image
based on the specified image path. The image has to be on
the applications class-path. Uses the specified classloader to load the image.path
- the path to the imageimageLoader
- the classloader to usejava.lang.IllegalArgumentException
- SWTException
- @Deprecated public static Image getImage(java.lang.String path, java.io.InputStream inputStream)
Image(Device, InputStream)} instead.
Image
based on the specified image path. The image will be read
from the provided InputStream.path
- the path the image resource is registered atinputStream
- the input stream for the imagejava.lang.IllegalArgumentException
- SWTException
- @Deprecated public static Point textExtent(Font font, java.lang.String string, int wrapWidth)
GC.textExtent(String)
. Don't forget to dispose the
GC afterwards.The extent of a string is the width and height of the rectangular area it would cover if drawn in a particular font.
font
- the font for which the result is validstring
- the string to measurewrapWidth
- the maximum width of the text. The text will be wrapped to match this width.
If set to 0, no wrapping will be performed.java.lang.IllegalArgumentException
- @Deprecated public static Point stringExtent(Font font, java.lang.String string)
GC.stringExtent(String)
. Don't forget to dispose the GC
afterwards.The extent of a string is the width and height of the rectangular area it would cover if drawn in a particular font.
font
- the font for which the result is validstring
- the string to measurejava.lang.IllegalArgumentException
- @Deprecated public static int getCharHeight(Font font)
GC.stringExtent(String)
with a string of your choice and get
the height of the result.font
- the font for which the result is validjava.lang.IllegalArgumentException
- @Deprecated public static float getAvgCharWidth(Font font)
GC.stringExtent(String)
with a string of your
choice and calculate the average width.font
- the font for which the result is validjava.lang.IllegalArgumentException
-
Copyright (c) EclipseSource and others 2002, 2014.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0