本文整理汇总了Java中javafx.application.Platform.exit方法的典型用法代码示例。如果您正苦于以下问题:Java Platform.exit方法的具体用法?Java Platform.exit怎么用?Java Platform.exit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.application.Platform
的用法示例。
在下文中一共展示了Platform.exit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Context
import javafx.application.Platform; //导入方法依赖的package包/类
/**
* Vytvoří nový kontext apliakce
*
* @param databaseName Název databáze
*/
public Context(String databaseName, ResourceBundle resources) throws FileNotFoundException {
this.resources = resources;
this.appDirectory = new File(appDirs
.getUserDataDir(CREDENTAILS_APP_NAME, CREDENTAILS_APP_VERSION, CREDENTILS_APP_AUTHOR));
if (!appDirectory.exists()) {
if (!appDirectory.mkdirs()) {
logger.error("Nepodařilo se vytvořit složku aplikace, zavírám...");
Platform.exit();
}
}
logger.info("Používám pracovní adresář: {}", appDirectory.getPath());
try {
database = new SQLite(appDirectory.getPath() + SEPARATOR + databaseName);
} catch (SQLException e) {
throw new FileNotFoundException();
}
initFirebase();
userManager = new UserManager(FirebaseDatabase.getInstance());
initManagers();
}
示例2: selfRestart
import javafx.application.Platform; //导入方法依赖的package包/类
/**
* Restarts the application.
*/
private static void selfRestart() {
if (!PathConstants.OWN_JAR.getName().endsWith(".jar")) {
// The application wasn't run with a jar file, but in an ide.
return;
}
final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
final List<String> command = new ArrayList<>();
command.add(javaBin);
command.add("-jar");
command.add(PathConstants.OWN_JAR.getPath());
try {
final ProcessBuilder builder = new ProcessBuilder(command);
builder.start();
Platform.exit();
}
catch (final IOException exception) {
Logging.error("Couldn't selfrestart.", exception);
}
}
示例3: logoutUser
import javafx.application.Platform; //导入方法依赖的package包/类
@FXML
public void logoutUser() {
if(EventScheduleController.tryResetSideContent() == null) {
ButtonType buttonType = MessageHelper.showLogoutUserMessage();
if (buttonType.getText().equals("Cancel")) {
//do nothing
} else if (buttonType.getText().equals("Switch User")) {
AccountAdministrationManager.getInstance().resetUser();
PlanchesterGUI.showLogin();
} else if (buttonType.getText().equals("Logout & Close")) {
DatabaseSessionManager.closeSession();
Platform.exit();
System.exit(0);
}
}
}
示例4: handle
import javafx.application.Platform; //导入方法依赖的package包/类
@Override
public void handle(WindowEvent t) {
if(!isClosed) {
logger.info("Closing the application gracefully");
try {
subscriber.disconnect();
publisher.disconnect();
discoverer.stop();
isClosed = true;
} catch (IOException e) {
logger.fatal(e);
}
Platform.exit();
}
}
示例5: exitClicked
import javafx.application.Platform; //导入方法依赖的package包/类
@FXML private void exitClicked(ActionEvent event) {
// Try to shut everything down gracefully
changesMonitor.stop();
liveQuery.stop();
service.stopReplication();
db.close();
db.getManager().close();
Platform.exit();
}
示例6: onExitAction
import javafx.application.Platform; //导入方法依赖的package包/类
private EventHandler<ActionEvent> onExitAction() {
return new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
Platform.exit();
}
};
}
示例7: closeWindow
import javafx.application.Platform; //导入方法依赖的package包/类
@FXML
public void closeWindow() {
Main.csvfiler.closeFiles();
Platform.exit();
System.exit(0);
}
示例8: closePlanchester
import javafx.application.Platform; //导入方法依赖的package包/类
private static void closePlanchester() {
DatabaseSessionManager.closeSession();
Platform.exit();
System.exit(0);
}
示例9: quitAction
import javafx.application.Platform; //导入方法依赖的package包/类
@FXML
private void quitAction(ActionEvent event) {
Platform.exit();
}
示例10: updateHallScore
import javafx.application.Platform; //导入方法依赖的package包/类
void updateHallScore(String player, String pass, boolean exit) {
if (userLevels().size() == 0) {
mHttpResponse = "";
if(exit) {
Toast.makeText(mGameStage, "Connecting Hall of Fame...", TOAST_LENGTH_LONG);
}
Thread thread = new Thread(() -> {
try {
StringBuilder url = new StringBuilder();
String part0 = "http://nwg.pl/eist/player.php?action=updateall&uname=" + player + "&upswd=" + pass + "&ulevel=" +
(mAchievedLevel - 1) + "&uturns=" + totalTurns();
url.append(part0);
for (int i = 1; i < MAX_LEVEL + 1; i++) {
url.append("&l");
url.append(lvlToString(i));
url.append("=");
url.append(prefs.getInt(lvlToString(i) + "best", 0));
}
mHttpResponse = HttpURLConnection.sendGet(url.toString());
} catch (Exception e) {
Platform.runLater(() -> Toast.makeText(mGameStage, "Connection error: " + e, TOAST_LENGTH_LONG));
}
if (!mHttpResponse.isEmpty()) {
if (mHttpResponse.equals("scores_updated")) {
Platform.runLater(() -> Toast.makeText(mGameStage, "Hall of Fame updated", TOAST_LENGTH_SHORT));
mResultsChanged = false;
} else {
Platform.runLater(() -> Toast.makeText(mGameStage, "Failed saving results, press 'S' to retry", TOAST_LENGTH_LONG));
}
}
if (exit) {
Platform.runLater(() -> {
Platform.runLater(Platform::exit);
});
}
});
thread.start();
} else {
Platform.exit();
}
}
示例11: exit
import javafx.application.Platform; //导入方法依赖的package包/类
private void exit(){
vertx.close();
Platform.exit();
System.exit(0);
}
示例12: closeApplication
import javafx.application.Platform; //导入方法依赖的package包/类
@FXML
protected void closeApplication(ActionEvent event) {
Platform.exit();
}
示例13: exitApp
import javafx.application.Platform; //导入方法依赖的package包/类
@FXML
void exitApp(ActionEvent event) {
Platform.exit();
System.exit(0);
}
示例14: handleLeaveClick
import javafx.application.Platform; //导入方法依赖的package包/类
@FXML
public void handleLeaveClick(){
Platform.exit();
}
示例15: closeProgram
import javafx.application.Platform; //导入方法依赖的package包/类
@FXML
void closeProgram(ActionEvent event) {
stopSpeechRecognition();
Platform.exit();
}