JavaFX events not firing

I have a JavaFX scene containing a Label, ListView and a Button. My action event is not firing when the button is clicked. Does anyone know why this might be happening? The application so far has two scenes. The first scene is changing to this scene by setting the Stage’s scene member to an instance of this scene.

public class CharacterSelectScene extends Scene, CharacterSelectUi {
    var listener: CharacterSelectUiListener;
    var characters: Sequence;
    var listView: ListView;

    override public function setCharacterSelectUiListener(arg0: CharacterSelectUiListener): Void {
        this.listener = listener;
    }

    override public function setCharacters(arg0: Map): Void {
        characters = for (k in arg0.keySet()) {
            CharacterEntry {
                id: k as CharacterId
                name: arg0.get(k) as String
            }
        }
    }

    override public function getCharacterSelectUiListener(): CharacterSelectUiListener {
        return listener;
    }

    override public function setCharacterSelectEnabled(arg0: Boolean): Void {
        
    }

    init {
        listView = ListView {
                    translateX: 0
                    translateY: 0
                    layoutInfo: LayoutInfo { height: 150 }
                    items: bind characters;
                    cellFactory: function() {
                        def cell: ListCell = ListCell {
                                    node: HBox {
                                        content: [
                                            Label { text: bind
                                                if (cell.empty)
                                                then ""
                                                else ((cell.item as CharacterEntry).name) }
                                        ]
                                    }
                                }
                    }
                };
        content = VBox {
                    content: [
                        Text { content: "Characters" },
                        listView,
                        Button {
                            text: "Select"
                            action: function() {
                                if (listener != null) {
                                    var ch : CharacterEntry = listView.selectedItem as CharacterEntry;
                                    if (ch != null) {
                                        listener.characterSelected(ch.id);
                                    }
                                }
                            }
                        }
                    ]
                }
    }

}

OK, so I’ve narrowed the issue down to my action event handler. It’s the strangest thing… If I place a breakpoint in the function, it is only hit if I remove other lines later in the function. Check out the code:


content = Button {
            text: "Select"
            action: function() {
                // Breakpoint on the next line. It is only hit if I comment out the contents of the if block. Otherwise it's like
                // the method is never even called.
                if (this.listener != null) {
                    var ch: CharacterEntry = listView.selectedItem as CharacterEntry;
                    if (ch != null) {
                        listener.characterSelected(ch.id);
                    }
                }
            }
        }

I’m worried that this is a compiler error. That would be disappointing because I’ve been excited about JavaFX ever since I heard about it a couple years ago. I’ve tried porting a project to it at 1.0, 1.2 and now 1.3 and each time encountered some sort of issue like this that let me know that it’s just not ready yet.

OK, I’ve solved my problem. I believe the issue with the breakpoint not being hit is a netbeans issue.