O'Reilly logo

JavaFX in Action by Simon Morris

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required