Java Reference
In-Depth Information
To illustrate how to use CSS concepts, we are going to reuse the form created in the recipe
Creating a form with JavaFX controls . In this recipe, we will extend the code for the form
to include CSS formatting. Since the form code has been discussed previously, we will
concentrate on the CSS portion of the code.
How to do it...
The abbreviated code snippet given next shows instances where CSS is used to format GUI
control elements in the data input form. You can see the full listing of the code in ch04/
source-code/src/styling/DataFormInlineCssDemo.fx .
def heading = Text {
content:"Employee Information"
style :"font-family:\"Helvetica\";"
"font-size:24pt;"
"font-weight:bold;"
}
def nameRow = HBox {
spacing:7
content:[
VBox{content:[
Label {text:"First Name" style :"textFill:blue"},
TextBox {
id:"fName"
style :"textFill:yellow; "
"backgroundFill:lightblue;"
"borderFill:lightblue"
}
]}
]
}
...
def btnRow = HBox {
spacing:7
content:[
Button {
text:"Submit"
style :"textFill:blue;fill:lightblue"
}
Button{text:"Clear"
style:"textFill:blue;fill:lightblue"}
]
}
 
Search WWH ::




Custom Search