| java.lang.Object org.jfree.experimental.swt.SWTUtils
SWTUtils | public class SWTUtils (Code) | | Utility class gathering some useful and general method.
Mainly convert forth and back graphical stuff between
awt and swt.
|
Field Summary | |
final protected static JPanel | DUMMY_PANEL A dummy JPanel used to provide font metrics. |
Method Summary | |
public static java.awt.Color | toAwtColor(Color color) Creates an awt color instance to match the rgb values
of the specified swt color.
Parameters: color - The swt color to match. | public static java.awt.Font | toAwtFont(Device device, FontData fontData, boolean ensureSameSize) Create an awt font by converting as much information
as possible from the provided swt FontData .
Generally speaking, given a font size, an swt font will
display differently on the screen than the corresponding awt
one. | public static java.awt.Font | toAwtFont(Device device, Font font) Create an awt font by converting as much information
as possible from the provided swt Font .
Parameters: device - The swt device to draw on (display or gc device). Parameters: font - The swt font to convert. | public static MouseEvent | toAwtMouseEvent(org.eclipse.swt.widgets.Event event) Creates an AWT MouseEvent from a swt event.
This method helps passing SWT mouse event to awt components.
Parameters: event - The swt event. | public static Point2D | toAwtPoint(Point p) Returns an AWT point with the same coordinates as the specified
SWT point.
Parameters: p - the SWT point (null not permitted). | public static Rectangle2D | toAwtRectangle(Rectangle rect) Transform a swt Rectangle instance into an awt one. | public static Color | toSwtColor(Device device, java.awt.Paint paint) Creates a swt color instance to match the rgb values
of the specified awt paint. | public static Color | toSwtColor(Device device, java.awt.Color color) Creates a swt color instance to match the rgb values
of the specified awt color. | public static FontData | toSwtFontData(Device device, java.awt.Font font, boolean ensureSameSize) Create a FontData object which encapsulate
the essential data to create a swt font. | public static Point | toSwtPoint(java.awt.Point p) Returns an SWT point with the same coordinates as the specified
AWT point.
Parameters: p - the AWT point (null not permitted). | public static Point | toSwtPoint(java.awt.geom.Point2D p) Returns an SWT point with the same coordinates as the specified AWT
point (rounded to integer values).
Parameters: p - the AWT point (null not permitted). | public static Rectangle | toSwtRectangle(Rectangle2D rect2d) Transform an awt Rectangle2d instance into a swt one.
The coordinates are rounded to integer for the swt object.
Parameters: rect2d - The awt rectangle to map. |
DUMMY_PANEL | final protected static JPanel DUMMY_PANEL(Code) | | A dummy JPanel used to provide font metrics.
|
toAwtColor | public static java.awt.Color toAwtColor(Color color)(Code) | | Creates an awt color instance to match the rgb values
of the specified swt color.
Parameters: color - The swt color to match. an awt color abject. |
toAwtFont | public static java.awt.Font toAwtFont(Device device, FontData fontData, boolean ensureSameSize)(Code) | | Create an awt font by converting as much information
as possible from the provided swt FontData .
Generally speaking, given a font size, an swt font will
display differently on the screen than the corresponding awt
one. Because the SWT toolkit use native graphical ressources whenever
it is possible, this fact is plateform dependent. To address
this issue, it is possible to enforce the method to return
an awt font with the same height as the swt one.
Parameters: device - The swt device being drawn on (display or gc device). Parameters: fontData - The swt font to convert. Parameters: ensureSameSize - A boolean used to enforce the same size (in pixels) between the swt font and the newly created awt font. An awt font converted from the provided swt font. |
toAwtFont | public static java.awt.Font toAwtFont(Device device, Font font)(Code) | | Create an awt font by converting as much information
as possible from the provided swt Font .
Parameters: device - The swt device to draw on (display or gc device). Parameters: font - The swt font to convert. An awt font converted from the provided swt font. |
toAwtMouseEvent | public static MouseEvent toAwtMouseEvent(org.eclipse.swt.widgets.Event event)(Code) | | Creates an AWT MouseEvent from a swt event.
This method helps passing SWT mouse event to awt components.
Parameters: event - The swt event. A AWT mouse event based on the given SWT event. |
toAwtPoint | public static Point2D toAwtPoint(Point p)(Code) | | Returns an AWT point with the same coordinates as the specified
SWT point.
Parameters: p - the SWT point (null not permitted). An AWT point with the same coordinates as p . See Also: SWTUtils.toSwtPoint(java.awt.Point) |
toAwtRectangle | public static Rectangle2D toAwtRectangle(Rectangle rect)(Code) | | Transform a swt Rectangle instance into an awt one.
Parameters: rect - the swt Rectangle a Rectangle2D.Double instance with the eappropriate location and size. |
toSwtColor | public static Color toSwtColor(Device device, java.awt.Paint paint)(Code) | | Creates a swt color instance to match the rgb values
of the specified awt paint. For now, this method test
if the paint is a color and then return the adequate
swt color. Otherwise plain black is assumed.
Parameters: device - The swt device to draw on (display or gc device). Parameters: paint - The awt color to match. a swt color object. |
toSwtColor | public static Color toSwtColor(Device device, java.awt.Color color)(Code) | | Creates a swt color instance to match the rgb values
of the specified awt color. alpha channel is not supported.
Note that the dispose method will need to be called on the
returned object.
Parameters: device - The swt device to draw on (display or gc device). Parameters: color - The awt color to match. a swt color object. |
toSwtFontData | public static FontData toSwtFontData(Device device, java.awt.Font font, boolean ensureSameSize)(Code) | | Create a FontData object which encapsulate
the essential data to create a swt font. The data is taken
from the provided awt Font.
Generally speaking, given a font size, the returned swt font
will display differently on the screen than the awt one.
Because the SWT toolkit use native graphical ressources whenever
it is possible, this fact is plateform dependent. To address
this issue, it is possible to enforce the method to return
a font with the same size (or at least as close as possible)
as the awt one.
When the object is no more used, the user must explicitely
call the dispose method on the returned font to free the
operating system resources (the garbage collector won't do it).
Parameters: device - The swt device to draw on (display or gc device). Parameters: font - The awt font from which to get the data. Parameters: ensureSameSize - A boolean used to enforce the same size (in pixels) between the awt font and the newly created swt font. a FontData object. |
toSwtPoint | public static Point toSwtPoint(java.awt.Point p)(Code) | | Returns an SWT point with the same coordinates as the specified
AWT point.
Parameters: p - the AWT point (null not permitted). An SWT point with the same coordinates as p . See Also: SWTUtils.toAwtPoint(Point) |
toSwtPoint | public static Point toSwtPoint(java.awt.geom.Point2D p)(Code) | | Returns an SWT point with the same coordinates as the specified AWT
point (rounded to integer values).
Parameters: p - the AWT point (null not permitted). An SWT point with the same coordinates as p . See Also: SWTUtils.toAwtPoint(Point) |
toSwtRectangle | public static Rectangle toSwtRectangle(Rectangle2D rect2d)(Code) | | Transform an awt Rectangle2d instance into a swt one.
The coordinates are rounded to integer for the swt object.
Parameters: rect2d - The awt rectangle to map. an swt Rectangle object. |
|
|