重构代码
This commit is contained in:
parent
dc4f37623a
commit
33c7116af2
@ -1,7 +1,7 @@
|
|||||||
package org.jcnc.jnotepad;
|
package org.jcnc.jnotepad;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GameConstants持有所有共享信息的全局变量
|
* Constants持有所有共享信息的全局变量
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
@ -9,4 +9,6 @@ public class Constants {
|
|||||||
public static final double SCREEN_WIDTH = 800;
|
public static final double SCREEN_WIDTH = 800;
|
||||||
public static final double SCREEN_LENGTH = 600;
|
public static final double SCREEN_LENGTH = 600;
|
||||||
|
|
||||||
|
public static final String APP_NAME = "JNotepad";
|
||||||
|
public static final String APP_ICON = "/img/icon.png";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,19 +30,21 @@ public class MainApp extends Application {
|
|||||||
|
|
||||||
double width = Constants.SCREEN_WIDTH;
|
double width = Constants.SCREEN_WIDTH;
|
||||||
double length = Constants.SCREEN_LENGTH;
|
double length = Constants.SCREEN_LENGTH;
|
||||||
|
String name = Constants.APP_NAME;
|
||||||
|
String icon =Constants.APP_ICON;
|
||||||
|
|
||||||
Scene scene = new Scene(root, width, length);
|
Scene scene = new Scene(root, width, length);
|
||||||
|
|
||||||
primaryStage.setTitle("JNotepad");
|
primaryStage.setTitle(name);
|
||||||
primaryStage.setWidth(width);
|
primaryStage.setWidth(width);
|
||||||
primaryStage.setHeight(length);
|
primaryStage.setHeight(length);
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene);
|
||||||
primaryStage.getIcons().add(new Image((Objects.requireNonNull(getClass().getResource("/img/icon.png"))).toString()));
|
primaryStage.getIcons().add(new Image((Objects.requireNonNull(getClass().getResource(icon))).toString()));
|
||||||
primaryStage.show();
|
primaryStage.show();
|
||||||
|
|
||||||
ViewManager poolGame = ViewManager.getInstance(scene);
|
ViewManager viewManager = ViewManager.getInstance(scene);
|
||||||
|
|
||||||
poolGame.initScreen(scene);
|
viewManager.initScreen(scene);
|
||||||
|
|
||||||
initApp();
|
initApp();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user