Java Reference
In-Depth Information
name is translated on the style sheet. For example,
unvisitedFill
is unvisited-fill
in the style sheet. Table 5.4 shows the available CSS properties for this control.
Ta b l e 5 . 4
HyperText CSS Attributes
CSS Attribute
JavaFX Attribute
Type
wrapping-width
wrappingWidth
Number
underline
underline
Boolean
overline
overline
Boolean
strikethrough
strikethrough
Boolean
unvisited-fill
unvisitedFill
paint
visited-fill
visitedFill
paint
font
font
font
:hover
Boolean
:pressed
Boolean
:focused
Boolean
The last part of the
Skin
source is the actual creation of the node that will be dis-
played. This is similar to the
CustomNode
example; however, instead of returning
a node in the
create()
function, you actually have to assign the node to the
scene
variable inherited from
javafx.scene.control.Skin
. Notice the mouse
handling for the enclosing rectangle. When the user does a mouse action over the
hypertext, this sets the corresponding variables on the
Skin
so that the CSS
pseudo variables, :focused, :hover, and :pressed, are operational. This is shown
in Listing 5.31.
Listing 5.31
Custom Skin - Node Creation
var enclosingRect: Rectangle;
protected override function requestFocus():Void {
enclosingRect.requestFocus();
}
var _focus = bind enclosingRect.focused on replace {
focused = _focus;
}
Search WWH ::
Custom Search