重构代码
This commit is contained in:
parent
dc4f37623a
commit
33c7116af2
@ -1,12 +1,14 @@
|
||||
package org.jcnc.jnotepad;
|
||||
|
||||
/**
|
||||
* GameConstants持有所有共享信息的全局变量
|
||||
* Constants持有所有共享信息的全局变量
|
||||
*/
|
||||
|
||||
public class Constants {
|
||||
|
||||
public static final double SCREEN_WIDTH = 800;
|
||||
public static final double SCREEN_LENGTH = 600;
|
||||
public static final double SCREEN_WIDTH = 800;
|
||||
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 length = Constants.SCREEN_LENGTH;
|
||||
String name = Constants.APP_NAME;
|
||||
String icon =Constants.APP_ICON;
|
||||
|
||||
Scene scene = new Scene(root, width, length);
|
||||
|
||||
primaryStage.setTitle("JNotepad");
|
||||
primaryStage.setTitle(name);
|
||||
primaryStage.setWidth(width);
|
||||
primaryStage.setHeight(length);
|
||||
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();
|
||||
|
||||
ViewManager poolGame = ViewManager.getInstance(scene);
|
||||
ViewManager viewManager = ViewManager.getInstance(scene);
|
||||
|
||||
poolGame.initScreen(scene);
|
||||
viewManager.initScreen(scene);
|
||||
|
||||
initApp();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user