Chapter 11. Best of both worlds: using JavaFX from Java

This chapter covers

  • Mixing JavaFX into Java programs
  • Calling JavaFX Script as a scripting language
  • Defining our Java app’s Swing UI in JavaFX
  • Adding JavaFX to the Java classpath

In previous chapters we saw plenty of examples demonstrating Java classes being used from JavaFX Script. Now it’s time for an about-face; how do we call JavaFX Script from Java?

Because JavaFX Script compiles directly to JRE-compatible bytecode, it might be tempting to assume we can treat JavaFX-created classes in much the same way we might treat compiled Java classes or JARs. But this would be unwise. There are enough differences between the two languages for assumption making to be a dangerous business. ...

Get JavaFX in Action 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.