java - Close dialog in JavaFX -


i have simple dialog in javafx:

stage dialogstage = new stage();         dialogstage.initmodality(modality.window_modal);         dialogstage.setscene(new scene(vboxbuilder.create()                 .children(new text(text), new button("close")).alignment(pos.center).padding(new insets(5)).build(), xsize, ysize, backgroundcolor));         dialogstage.show(); 

i want close dialog when click on close button modified code way:

stage dialogstage = new stage();         dialogstage.initmodality(modality.window_modal);         dialogstage.setscene(new scene(vboxbuilder.create()                 .children(new text(text), new button("close").setonaction(new eventhandler<actionevent>() {             @override             public void handle(actionevent e) {                 aboutdialog();             }         })).alignment(pos.center).padding(new insets(5)).build(), xsize, ysize, backgroundcolor));         dialogstage.show(); 

but error message in netbeans: 'void' type not allowed here

can tell em proper way close dialog using close button?

instead of

@override public void handle(actionevent e) {   aboutdialog(); } 

try

@override public void handle(actionevent e) {   dialogstage.hide(); } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -