修复文件读写的乱码问题

This commit is contained in:
peng
2021-10-29 10:43:02 +08:00
parent 6488cede83
commit b74033acf1
7 changed files with 71 additions and 46 deletions

View File

@@ -47,10 +47,10 @@ import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import javafx.util.Callback;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -121,7 +121,7 @@ public class HomePage {
primaryStage.setHeight(configuration.getHeight());
primaryStage.getIcons().add(getIcon());
primaryStage.show();
primaryStage.setOnCloseRequest(event -> FileUtils.saveConfig(configuration));
primaryStage.setOnCloseRequest(event -> ConfigHolder.save());
}
public void drawServerPanel(VBox serverContainer, ServerConfig serverConfig, Stage primaryStage) {
@@ -253,12 +253,7 @@ public class HomePage {
}
public Image getIcon() {
try {
return new Image(new FileInputStream(FileUtils.getResourcePath("panda.png")));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return null;
return new Image("resources/panda.png");
}
public Background getBackGround() {