Java Reference
In-Depth Information
}
// using PopupMenu in JavaFX
PopupMenu{
items:[
MenuItem{
title:"Hello!",
action:function({Alert.inform("Hi!")}
}
]
}
Class PopupMenu , defined above, is a façade that encapsulates and manages two Swing
components, mainly a JButton and a JpopupMenu . Function createJComponent()
initializes the internal Swing components and returns an instance of the JButton . You
can get the full code listing for this example from ch04/source-code/src/custom/
SwingFacadeDemo.fx .
See also
F Chapter 1—Declaring and using JavaFX classes
F Chapter 2—Creating your own custom node
F Introduction
F Creating a custom JavaFX control
Styling your applications with CSS
In previous recipes, we have seen how to control the look and feel of JavaFX graphical
nodes programmatically by setting property values on the node directly. Programmatic style
manipulation works just fine, but is hard to externalize. If you want to update the look of your
application, you must recompile. However, JavaFX also offers a way to declare styles using
Cascading Style Sheets (CSS). This recipe shows you how to apply styles declaratively to
JavaFX graphical nodes using CSS.
Getting ready
Before going through this recipe, you should have an idea of what CSS is and how it is used
for designing HTML web pages. Similar concepts are discussed here and other CSS-related
recipes in this chapter. CSS was created by the web governing body W3C and is traditionally
used for markup development languages such as HTML and other XML-derivatives (XUL,
SVG, and so on). For information about CSS, visit http://en.wikipedia.org/wiki/
Cascading_Style_Sheets.
 
Search WWH ::




Custom Search