如何在Java FX中从当前类的启动函数打开另一个类的启动函数?

时间:2018-10-19 00:49:38

标签: java javafx

我正在尝试使用N: 24 N: 27 Blocks: 3, (size: 8) Blocks: 4, (size: 8) threads: 4 threads: 1 -------------------------------------|------------------------------- thread 1: works on block 1 (8 - 16 ) thread 0: works on block 0 (0 - 8 ) thread 2: works on block 2 (16 - 24 ) thread 0: works on block 1 (8 - 16 ) thread 0: works on block 0 (0 - 8 ) thread 0: works on block 2 (16 - 24 ) thread 0: works on block 3 (24 - 27 ) -------------------------------------|------------------------------- 0 : 681191333 0 : 681191333 1 : 928546885 1 : 928546885 2 : 1457394273 2 : 1457394273 3 : 941445650 3 : 941445650 4 : 2129613237 4 : 2129613237 5 : 1661015563 5 : 1661015563 6 : 2071432601 6 : 2071432601 7 : 222443696 7 : 222443696 8 : 1156886562 8 : 1156886562 9 : 398918689 9 : 398918689 10 : 170756699 10 : 170756699 11 : 703115845 11 : 703115845 12 : 1424182583 12 : 1424182583 13 : 1516198481 13 : 1516198481 14 : 1740837599 14 : 1740837599 15 : 1148851528 15 : 1148851528 16 : 1633630368 16 : 1633630368 17 : 2015727614 17 : 2015727614 18 : 1031602773 18 : 1031602773 19 : 463737465 19 : 463737465 20 : 720848057 20 : 720848057 21 : 1369285272 21 : 1369285272 22 : 1411290150 22 : 1411290150 23 : 2074210785 23 : 2074210785 -------------------------------------|------------------------------- 24 : 2109326622 25 : 1486099418 26 : 1892448847 来制作数独游戏。我必须打开一个包含两个按钮JAVA FXNEW GAME的欢迎页面。如果单击CONTINUE GAME,则应打开NEW GAME,并应打开其舞台,然后关闭Sudoku.java文件和舞台。我该怎么做,甚至有可能做到?

Welcome.java

Welcome.java

package application; import javafx.application.Application; import javafx.event.EventHandler; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.input.MouseEvent; import javafx.scene.layout.*; public class Welcome extends Application{ @Override public void start(Stage primaryStage) { AnchorPane root = new AnchorPane(); root.setPrefHeight(400); root.setPrefWidth(350); try { Scene scene = new Scene(root, 350, 400); primaryStage.setScene(scene); primaryStage.show(); } catch(Exception e) { e.printStackTrace(); } Label label = new Label("Welcome to sudoku puzzle world!"); label.setLayoutX(5); label.setLayoutY(50); label.setPrefHeight(60); label.setPrefWidth(330); root.getChildren().add(label); Button new_game = new Button("NEW GAME"); new_game.setLayoutX(100); new_game.setLayoutY(140); new_game.setPrefHeight(60); new_game.setPrefWidth(140); new_game.setOnMouseClicked(new EventHandler<MouseEvent>() { public void handle(MouseEvent t) { // HOW TO OPEN THE Sudoku.java INSIDE HERE } }); root.getChildren().add(new_game); Button continue_game = new Button("CONTINUE GAME"); continue_game.setLayoutX(100); continue_game.setLayoutY(220); continue_game.setPrefHeight(60); continue_game.setPrefWidth(140); root.getChildren().add(continue_game); } public static void main(String[] args) { launch(args); } }

Sudoku.java

0 个答案:

没有答案