Class WBrush
public class WBrush extends WJavaScriptExposableObject
A brush defines the properties of how areas (the interior of shapes) are filled. A brush is defined either as a solid color or a gradient.
JavaScript exposability
A WBrush is JavaScript exposable. If a WBrush is JavaScript bound
, it can be accessed in your
custom JavaScript code through its handle's jsRef()
. At
the moment, only the getColor()
property is exposed, e.g. a brush with
the color WColor(10,20,30,255) will be represented in JavaScript as:
{
color: [10,20,30,255]
}
Warning: A WBrush 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
-
Method Summary
Modifier and Type Method Description protected void
assignFromJSON(com.google.gson.JsonElement value)
WBrush
clone()
Clone method.boolean
equals(WBrush other)
Indicates whether some other object is "equal to" this one.WColor
getColor()
Returns the brush color.WGradient
getGradient()
Returns the brush gradient.java.lang.String
getJsValue()
Returns a JavaScript representation of the value of this object.BrushStyle
getStyle()
Returns the fill style.void
setColor(WColor color)
Sets the brush color.void
setGradient(WGradient gradient)
Sets the brush gradient.void
setStyle(BrushStyle style)
Sets the brush style.Methods inherited from class eu.webtoolkit.jwt.WJavaScriptExposableObject
assignBinding, assignBinding, checkModifiable, closeTo, getJsRef, isJavaScriptBound, sameBindingAs
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
WBrush
public WBrush()Creates a brush.Creates a brush with a
BrushStyle.NoBrush
fill style. -
WBrush
Creates a brush with the given style. -
WBrush
Creates a solid brush of a given color.Creates a solid brush with the indicated
color
. -
WBrush
Creates a gradient brush.
-
-
Method Details
-
clone
Clone method.Clones this brush.
- Specified by:
clone
in classWJavaScriptExposableObject
-
equals
Indicates whether some other object is "equal to" this one.Returns
true
if the brushes are exactly the same. -
setStyle
Sets the brush style.- See Also:
getStyle()
-
getStyle
Returns the fill style.- See Also:
setStyle(BrushStyle style)
-
setColor
Sets the brush color.If the current style is a gradient style, then it is reset to
BrushStyle.SolidPattern
.- See Also:
getColor()
-
getColor
Returns the brush color.- See Also:
getColor()
-
setGradient
Sets the brush gradient.This also sets the style to
BrushStyle.GradientPattern
. -
getGradient
Returns the brush gradient. -
getJsValue
public java.lang.String getJsValue()Description copied from class:WJavaScriptExposableObject
Returns 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:
getJsValue
in classWJavaScriptExposableObject
-
assignFromJSON
protected void assignFromJSON(com.google.gson.JsonElement value)- Specified by:
assignFromJSON
in classWJavaScriptExposableObject
-