Planet JFX

JavaFX's version of "this"

118pages on
this wiki
Add New Page
Add New Page Talk0

While instantiating an object with JavaFX's object literal notation, you can declare a "this" variable with a var: statement:

class Parent {
    attribute child: Child;

class Child {
    attribute parent: Parent;

var aParent = Parent {
    var: myself   // refers to the aParent reference 
                  // (which isn't available for use in the next block)
    child: Child {
        parent: myself
println("equal? {aParent == aParent.child.parent}");

Also on Fandom

Random Wiki