当前位置: 首页>>代码示例>>Java>>正文


Java Platform.exit方法代码示例

本文整理汇总了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();
}
 
开发者ID:stechy1,项目名称:drd,代码行数:27,代码来源:Context.java

示例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);
	}
}
 
开发者ID:Bios-Marcel,项目名称:ServerBrowser,代码行数:26,代码来源:Client.java

示例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);
        }
    }
}
 
开发者ID:ITB15-S4-GroupD,项目名称:Planchester,代码行数:17,代码来源:PlanchesterFrameController.java

示例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();
    }
}
 
开发者ID:INAETICS,项目名称:Drones-Simulator,代码行数:16,代码来源:Game.java

示例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();
}
 
开发者ID:couchbaselabs,项目名称:CBM-Changes-Explorer,代码行数:11,代码来源:Controller.java

示例6: onExitAction

import javafx.application.Platform; //导入方法依赖的package包/类
private EventHandler<ActionEvent> onExitAction() {
return new EventHandler<ActionEvent>() {
    public void handle(ActionEvent event) {
          Platform.exit();
        }
    };
}
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:8,代码来源:MenuCreator.java

示例7: closeWindow

import javafx.application.Platform; //导入方法依赖的package包/类
@FXML
public void closeWindow() {
	Main.csvfiler.closeFiles();
	Platform.exit();
	System.exit(0);
}
 
开发者ID:X-Cats,项目名称:Scout2017,代码行数:7,代码来源:MatchInterfaceController.java

示例8: closePlanchester

import javafx.application.Platform; //导入方法依赖的package包/类
private static void closePlanchester() {
    DatabaseSessionManager.closeSession();
    Platform.exit();
    System.exit(0);
}
 
开发者ID:ITB15-S4-GroupD,项目名称:Planchester,代码行数:6,代码来源:PlanchesterGUI.java

示例9: quitAction

import javafx.application.Platform; //导入方法依赖的package包/类
@FXML
private void quitAction(ActionEvent event) {
    Platform.exit();
}
 
开发者ID:CIRDLES,项目名称:Squid,代码行数:5,代码来源:SquidUIController.java

示例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();
        }
    }
 
开发者ID:nwg-piotr,项目名称:EistReturns,代码行数:54,代码来源:Utils.java

示例11: exit

import javafx.application.Platform; //导入方法依赖的package包/类
private void exit(){
    vertx.close();
    Platform.exit();
    System.exit(0);
}
 
开发者ID:whitewoodcity,项目名称:xbrowser,代码行数:6,代码来源:Main.java

示例12: closeApplication

import javafx.application.Platform; //导入方法依赖的package包/类
@FXML
protected void closeApplication(ActionEvent event) {
    Platform.exit();
}
 
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:5,代码来源:DeskDroidController.java

示例13: exitApp

import javafx.application.Platform; //导入方法依赖的package包/类
@FXML
void exitApp(ActionEvent event) {
	Platform.exit();
	System.exit(0);
}
 
开发者ID:X-Cats,项目名称:Scout2017,代码行数:6,代码来源:PitIntController.java

示例14: handleLeaveClick

import javafx.application.Platform; //导入方法依赖的package包/类
@FXML 
public void handleLeaveClick(){
    Platform.exit();
}
 
开发者ID:Plinz,项目名称:Hive_Game,代码行数:5,代码来源:MainMenuController.java

示例15: closeProgram

import javafx.application.Platform; //导入方法依赖的package包/类
@FXML
void closeProgram(ActionEvent event) {

    stopSpeechRecognition();
    Platform.exit();
}
 
开发者ID:karanpratapsingh,项目名称:KenzieTheBot,代码行数:7,代码来源:MainController.java


注:本文中的javafx.application.Platform.exit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。