V
V
Verg1l2015-01-26 18:53:14
Java
Verg1l, 2015-01-26 18:53:14

How to close a window in javafx?

I don't know how to close the window. Tried typing this, but it doesn't work.

public void close() {
    	
    	Stage stage = new Stage();
    
    	stage.addWindowListener(new WindowAdapter() {
    	    @Override
    	    public void windowClosing(final WindowEvent event) {
    	        System.out.println(event);
    	        if (shouldClose()) {
    	            dialog.close();
    	        }
    	    }
    	});
    	
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Pavlov, 2015-01-27
@Verg1l

Why are you creating in the close Stage method?)))))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question