public class AwtUtilities extends java.lang.Object implements CSSProperties
ARC_HEIGHT, ARC_WIDTH, BACKGROUND_COLOR, BACKGROUND_IMAGE, BACKGROUND_RADIUS, BORDER_COLOR, BORDER_RADIUS, FILL_PAINT, FONT, FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_WEIGHT, IMAGE, OPACITY, REGION_BACKGROUND, REGION_BACKGROUND_POSITION, REGION_BACKGROUND_RADIUS, REGION_BACKGROUND_SIZE, REGION_BORDER, SCALE_SHAPE, SCALE_X, SCALE_Y, SHAPE, STROKE_DASHARRAY, STROKE_DASHOFFSET, STROKE_LINECAP, STROKE_LINEJOIN, STROKE_MITERLIMIT, STROKE_PAINT, STROKE_TYPE, STROKE_WIDTH, TEXT_BOUNDS_TYPE, TEXT_FILL, TRANSLATE_X, TRANSLATE_Y, VISIBILITY| Modifier and Type | Method and Description |
|---|---|
static java.awt.Color |
createDisabledColor(java.awt.Color color,
int grayScale)
Creates a disabled version of a Color.
|
static java.awt.Image |
createDisabledImage(java.awt.Image image,
int grayScale)
Creates a disabled version of an Image.
|
static java.awt.Image |
createOpacifiedImage(java.awt.Image image,
double opacity,
boolean multiply)
Creates a opacified version of an Image.
|
static java.awt.BasicStroke |
createStroke(double width)
Create a stroke of a specified width.
|
static java.awt.BasicStroke |
createStroke(double width,
javafx.scene.layout.BorderStrokeStyle strokeStyle)
Create a stroke of a specified width and a stroke style.
|
static java.util.Map<java.lang.String,CSSProperty> |
extractProperties(javafx.scene.Node node)
Extract the properties of a Node.
|
static java.util.Set<java.lang.String> |
extractPseudoClasses(javafx.scene.Node node)
Extract the pseudo-classes of a Node.
|
static java.awt.geom.AffineTransform |
getAffineTransform(javafx.scene.transform.Transform tr)
Return the Awt AffineTransform corresponding to a JavaFX Transform.
|
static java.awt.Color |
getAWTColor(javafx.scene.paint.Color col,
int grayScale,
double opacity,
boolean isDisabled)
Return the Awt Color corresponding to a JavaFX Color.Transparent JavaFX Colors will return null.
|
static java.awt.Color |
getAWTColorAcceptTransparent(javafx.scene.paint.Color col,
int grayScale,
double opacity,
boolean isDisabled)
Return the Awt Color corresponding to a JavaFX Color, including transparent colors.Transparent JavaFX Colors will return transparent Awt Colors.
|
static java.awt.Font |
getAWTFont(javafx.scene.text.Font font)
Return the Awt Font corresponding to a JavaFX Font.
|
static java.awt.Paint |
getAWTPaint(javafx.scene.layout.Region region,
javafx.scene.paint.Paint paint)
Return the Awt Paint for a JavaFX Paint.
|
static java.awt.Paint |
getAWTPaint(javafx.scene.layout.Region region,
javafx.scene.paint.Paint paint,
int grayScale,
double opacity)
Return the Awt Paint for a JavaFX Paint.
|
static java.awt.Paint |
getAWTPaint(javafx.scene.shape.Shape shape,
javafx.scene.paint.Paint paint,
int grayScale,
double opacity)
Return the Awt Paint for a JavaFX Paint.
|
static java.awt.Paint |
getAWTPaintAcceptTransparent(javafx.scene.shape.Shape shape,
javafx.scene.paint.Paint paint,
int grayScale,
boolean isDisabled)
Return the Awt Color corresponding to a JavaFX Color, including transparent colors.Transparent JavaFX Colors will return transparent Awt Colors.
|
static java.util.List<AwtBackgroundWrapper> |
getAWTPaintList(javafx.scene.layout.Region region,
javafx.scene.layout.Background background,
NodeGraphics2DConverter converter,
int grayScale,
double opacity)
Return the list of BackgroundWrappers for a Region.Note that a JavaFX Background contains a list of fills or Paints.
|
static java.util.List<AwtBorderWrapper> |
getAWTPaintList(javafx.scene.layout.Region region,
javafx.scene.layout.Border border)
Return the list of BorderWrappers for a Region.
|
static java.awt.TexturePaint |
getAWTTexture(javafx.scene.image.Image image,
javafx.scene.layout.Region region,
javafx.scene.layout.BorderWidths widths,
int grayScale)
Return an Awt TexturePaint corresponding to a JavaFX Image.
|
static java.awt.TexturePaint |
getAWTTexture(java.net.URL url,
javafx.scene.layout.Region region,
int grayScale,
double opacity)
Return the Awt Paint for a JavaFX Region and an associated URL for the corresponding Image texture.
|
static java.awt.geom.Rectangle2D |
getBounds(javafx.scene.Node node)
Return a Node bounds.
|
static java.awt.geom.Point2D |
getOrigin(javafx.scene.shape.SVGPath path)
Return the origin of a SVGPath (using the first MoveTo command).
|
static javafx.scene.text.FontPosture |
getPosture(javafx.scene.text.Font font)
Return the FontPosture of a JavaFX Font.
|
static javafx.scene.text.FontWeight |
getWeight(javafx.scene.text.Font font)
Return the FontWeight of a JavaFX Font.
|
static boolean |
isRelative(javafx.scene.shape.SVGPath path)
Return true if the position of a SVGPath is relative (using the first m or M moveTo command).
|
static java.awt.Shape |
toAWTPath(javafx.scene.shape.SVGPath path,
java.awt.geom.AffineTransform transform)
Convert a SVGPath to an Awt Shape and apply an AffineTransform on it.
|
public static java.awt.geom.Rectangle2D getBounds(javafx.scene.Node node)
node - the nodepublic static java.awt.Shape toAWTPath(javafx.scene.shape.SVGPath path,
java.awt.geom.AffineTransform transform)
path - the SVGPathtransform - the AffineTransformpublic static java.awt.geom.Point2D getOrigin(javafx.scene.shape.SVGPath path)
path - the SVGPathpublic static boolean isRelative(javafx.scene.shape.SVGPath path)
path - the SVGPathpublic static java.util.Set<java.lang.String> extractPseudoClasses(javafx.scene.Node node)
node - the Nodepublic static java.util.Map<java.lang.String,CSSProperty> extractProperties(javafx.scene.Node node)
node - the Nodepublic static java.awt.geom.AffineTransform getAffineTransform(javafx.scene.transform.Transform tr)
tr - the JavaFX Transformpublic static javafx.scene.text.FontPosture getPosture(javafx.scene.text.Font font)
font - the Fontpublic static javafx.scene.text.FontWeight getWeight(javafx.scene.text.Font font)
font - the Fontpublic static java.awt.Font getAWTFont(javafx.scene.text.Font font)
font - the JavaFX Fontpublic static java.awt.BasicStroke createStroke(double width,
javafx.scene.layout.BorderStrokeStyle strokeStyle)
width - the stroke widthstrokeStyle - the stroke stylepublic static java.awt.BasicStroke createStroke(double width)
width - the stroke widthpublic static java.util.List<AwtBorderWrapper> getAWTPaintList(javafx.scene.layout.Region region, javafx.scene.layout.Border border)
region - the Regionborder - the Backgroundpublic static java.util.List<AwtBackgroundWrapper> getAWTPaintList(javafx.scene.layout.Region region, javafx.scene.layout.Background background, NodeGraphics2DConverter converter, int grayScale, double opacity)
region - the Regionbackground - the Backgroundconverter - the NodeConvertergrayScale - the grayScale in percentopacity - the opacitypublic static java.awt.Paint getAWTPaintAcceptTransparent(javafx.scene.shape.Shape shape,
javafx.scene.paint.Paint paint,
int grayScale,
boolean isDisabled)
shape - the shapepaint - the PaintgrayScale - the grayScale percentisDisabled - true if the Node is disabledpublic static java.awt.Paint getAWTPaint(javafx.scene.shape.Shape shape,
javafx.scene.paint.Paint paint,
int grayScale,
double opacity)
shape - the Shape where to apply the Paintopacity - the opacitygrayScale - the grayScale in percentpaint - the Paintpublic static java.awt.Paint getAWTPaint(javafx.scene.layout.Region region,
javafx.scene.paint.Paint paint)
region - the Region where to apply the Paintpaint - the Paintpublic static java.awt.Paint getAWTPaint(javafx.scene.layout.Region region,
javafx.scene.paint.Paint paint,
int grayScale,
double opacity)
region - the Region where to apply the Paintpaint - the PaintgrayScale - the grayScale in percentopacity - the opacitypublic static java.awt.TexturePaint getAWTTexture(java.net.URL url,
javafx.scene.layout.Region region,
int grayScale,
double opacity)
region - the JavaFX Regionurl - the URL for the corresponding Image texturegrayScale - the grayScale in percentopacity - the opaoitypublic static java.awt.TexturePaint getAWTTexture(javafx.scene.image.Image image,
javafx.scene.layout.Region region,
javafx.scene.layout.BorderWidths widths,
int grayScale)
image - the JavaFX Imageregion - the Regionwidths - the associated JavaFX BorderWidthsgrayScale - the grayScale in percentpublic static java.awt.Color getAWTColorAcceptTransparent(javafx.scene.paint.Color col,
int grayScale,
double opacity,
boolean isDisabled)
col - the JavaFX ColorgrayScale - the grayScale percentopacity - the opacityisDisabled - true if the Node is disabledpublic static java.awt.Color getAWTColor(javafx.scene.paint.Color col,
int grayScale,
double opacity,
boolean isDisabled)
col - the JavaFX ColorgrayScale - the grayScale percentopacity - the opacityisDisabled - true if the Region is disabledpublic static java.awt.Image createDisabledImage(java.awt.Image image,
int grayScale)
image - the ImagegrayScale - the grayScale percentpublic static java.awt.Image createOpacifiedImage(java.awt.Image image,
double opacity,
boolean multiply)
image - the Imageopacity - the opacity valuemultiply - true if the current pixels opacity value must be multiplied by the opacity value, false if the opacity value must replace the
current pixel opacity valuepublic static java.awt.Color createDisabledColor(java.awt.Color color,
int grayScale)
color - the ColorgrayScale - the grayScale percentCopyright © 2021, 2022, 2025, 2026 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence