JavaFX Script Keywords and Java Interoperability

how-to
Jan 7, 20091 min

In JavaFX script any sequence of characters enclosed in “french quotes” is treated as a lexical identifier, and thus may be used as a valid name of a variable, function, or class.

  var <<this is a variable>> = "Hello World";
  <<this is a variable>>.toUpperCase();

This mechanism may be used to access Java methods which conflict with JavaFX keywords, for example:

  var textField = new javax.swing.JTextField();
  textField.<<insert>>("Hello World");

This mechanism is also useful for code generators in translating symbols from other languages having incompatible lexical rules to JavaFX script.