Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package subelergiris; import javafx.application.Application; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.stage.WindowEvent; import org.hibernate.SessionFactory; /** * * @author Lenovo */ public class SubelerGiris extends Application { @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("SubelerGiris.fxml")); Scene scene = new Scene(root); stage.setScene(scene); stage.setOnCloseRequest(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { SessionFactory sf = NewHibernateUtil.getSessionFactory(); sf.close(); } }); stage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }