Class WPen
- java.lang.Object
-
- eu.webtoolkit.jwt.WJavaScriptExposableObject
-
- eu.webtoolkit.jwt.WPen
-
public class WPen extends WJavaScriptExposableObject
A value class that defines the style for pen strokes.A pen defines the properties of how lines (that may surround shapes) are rendered.
A pen with width 0 is a cosmetic pen, and is always rendered as 1 pixel width, regardless of transformations. Otherwized, the pen width is modified by the
transformationset on the painter.JavaScript exposability
A WPen is JavaScript exposable. If a WPen
is JavaScript bound, it can be accessed in your custom JavaScript code throughits handle's jsRef(). At the moment, only thegetColor()property is exposed, e.g. a pen with the color WColor(10,20,30,255) will be represented in JavaScript as:{ color: [10,20,30,255] }Warning: A WPen that is JavaScript exposed should be modified only through its
handle. Any attempt at modifying it will cause an exception to be thrown.
-
-
Constructor Summary
Constructors Constructor Description WPen()Creates a black cosmetic pen.WPen(PenStyle style)Creates a black pen with a particular style.WPen(StandardColor color)Creates a solid pen of a standard color.WPen(WColor color)Creates a solid pen of a particular color.WPen(WGradient gradient)Creates a solid pen with a gradient color.WPen(WPen other)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidassignFromJSON(com.google.gson.JsonElement value)WPenclone()Clone method.booleanequals(WPen other)Indicates whether some other object is "equal to" this one.PenCapStylegetCapStyle()Returns the style for rendering line ends.WColorgetColor()Returns the pen color.WGradientgetGradient()Returns the pen color gradient.PenJoinStylegetJoinStyle()Returns the style for rendering line joins.java.lang.StringgetJsValue()Returns a JavaScript representation of the value of this object.PenStylegetStyle()Returns the pen style.WLengthgetWidth()Returns the pen width.voidsetCapStyle(PenCapStyle style)Sets the style for rendering line ends.voidsetColor(WColor color)Sets the pen color.voidsetGradient(WGradient gradient)Sets the pen color as a gradient.voidsetJoinStyle(PenJoinStyle style)Sets the style for rendering line joins.voidsetStyle(PenStyle style)Sets the pen style.voidsetWidth(WLength width)Sets the pen width.-
Methods inherited from class eu.webtoolkit.jwt.WJavaScriptExposableObject
assignBinding, assignBinding, checkModifiable, closeTo, getJsRef, isJavaScriptBound, sameBindingAs
-
-
-
-
Constructor Detail
-
WPen
public WPen()
Creates a black cosmetic pen.Constructs a black solid pen of 0 width (i.e. cosmetic single pixel width), with PenCapStyle::Square line ends and PenJoinStyle::Bevel line join style.
-
WPen
public WPen(PenStyle style)
Creates a black pen with a particular style.Constructs a black pen of 0 width (i.e. cosmetic single pixel width), with PenCapStyle::Square line ends and PenJoinStyle::Bevel line join style.
The line style is set to
style.
-
WPen
public WPen(WColor color)
Creates a solid pen of a particular color.Constructs a solid pen of 0 width (i.e. cosmetic single pixel width), with PenCapStyle::Square line ends and PenJoinStyle::Bevel line join style.
The pen color is set to
color.
-
WPen
public WPen(StandardColor color)
Creates a solid pen of a standard color.Constructs a solid pen of 0 width (i.e. cosmetic single pixel width), with PenCapStyle::Square line ends and PenJoinStyle::Bevel line join style.
The pen color is set to
color.
-
WPen
public WPen(WGradient gradient)
Creates a solid pen with a gradient color.Constructs a solid pen of 0 width (i.e. cosmetic single pixel width), with PenCapStyle::Square line ends and PenJoinStyle::Bevel line join style.
The pen's color is defined by the gradient
color.
-
WPen
public WPen(WPen other)
Copy constructor.
-
-
Method Detail
-
clone
public WPen clone()
Clone method.Clones this pen.
- Specified by:
clonein classWJavaScriptExposableObject
-
equals
public boolean equals(WPen other)
Indicates whether some other object is "equal to" this one.Returns
trueif the pens are exactly the same.
-
setStyle
public void setStyle(PenStyle style)
Sets the pen style.The pen style determines the pattern with which the pen is rendered.
-
getStyle
public PenStyle getStyle()
Returns the pen style.- See Also:
setStyle(PenStyle style)
-
setCapStyle
public void setCapStyle(PenCapStyle style)
Sets the style for rendering line ends.The cap style configures how line ends are rendered.
-
getCapStyle
public PenCapStyle getCapStyle()
Returns the style for rendering line ends.- See Also:
setCapStyle(PenCapStyle style)
-
setJoinStyle
public void setJoinStyle(PenJoinStyle style)
Sets the style for rendering line joins.The join style configures how corners are rendered between different segments of a poly-line, rectange or painter path.
-
getJoinStyle
public PenJoinStyle getJoinStyle()
Returns the style for rendering line joins.- See Also:
setJoinStyle(PenJoinStyle style)
-
setWidth
public void setWidth(WLength width)
Sets the pen width.A pen width
mustbe specified usingLengthUnit.Pixelunits.
-
getWidth
public WLength getWidth()
Returns the pen width.- See Also:
setWidth(WLength width)
-
setColor
public void setColor(WColor color)
Sets the pen color.
-
getColor
public WColor getColor()
Returns the pen color.- See Also:
setColor(WColor color)
-
setGradient
public void setGradient(WGradient gradient)
Sets the pen color as a gradient.- See Also:
setColor(WColor color)
-
getGradient
public WGradient getGradient()
Returns the pen color gradient.- See Also:
setGradient(WGradient gradient)
-
getJsValue
public java.lang.String getJsValue()
Description copied from class:WJavaScriptExposableObjectReturns a JavaScript representation of the value of this object.Note: The value returned will reflect the current server side value of the object. If this object is JavaScript bound, this value may not reflect the actual client side value. If you need access to the client side value, use
getJsRef()intead.- Specified by:
getJsValuein classWJavaScriptExposableObject
-
assignFromJSON
protected void assignFromJSON(com.google.gson.JsonElement value)
- Specified by:
assignFromJSONin classWJavaScriptExposableObject
-
-