25. Building Custom Controls

In this chapter, you see how to build new user interface components. In the first part of this chapter, we create a simple component by extending the CustomNode class. The advantage of this approach is that it is easy to create a working component but, on the downside, its visual appearance is more or less fixed—although you can change its colors, fonts, and so on, you can’t radically change the way that it looks. Later in this chapter, you see how to build a more flexible component, at the cost of a little more effort, by subclassing the Control class. Unlike a custom node, a control does not have a fixed visual representation—instead, it has a skin, which can be replaced to give the control a different appearance ...

Get JavaFX™ Developer’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.