Java 场景生成器预览和正在执行的程序之间的不同布局
执行程序时,界面与场景生成器预览不同。这个问题快把我逼疯了。我能做些什么来解决这个问题? FXML 这就是调度方法:Java 场景生成器预览和正在执行的程序之间的不同布局,java,css,javafx,fxml,scenebuilder,Java,Css,Javafx,Fxml,Scenebuilder,执行程序时,界面与场景生成器预览不同。这个问题快把我逼疯了。我能做些什么来解决这个问题? FXML 这就是调度方法: private void apriViewStart() throws Eccezione { try { AnchorPane root = (AnchorPane) FXMLLoader.load(getClass().getResource("/application/Login.fxml"));
private void apriViewStart() throws Eccezione {
try {
AnchorPane root = (AnchorPane) FXMLLoader.load(getClass().getResource("/application/Login.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("/application/application.css").toExternalForm());
Main.stage.setTitle("CarLoan 1.0");
Main.stage.setScene(scene);
Main.stage.show();
} catch (Exception e) {
throw new Eccezione("Impossibile caricare l'interfaccia.");
}
}
我不知道为什么,但是场景生成器预览和执行gui是不同的。为了解决这个问题,我必须更改CSS代码中的一些参数Exe?为什么是exe?请给我简单的。(通常我希望这是一个jar或一个包含
.class
文件的文件夹结构)发布您的FXML和CSS(如果您有样式表)以及运行它的代码。很抱歉,当我在Eclipse中执行我的程序时,使用exe lol
package application;
import Eccezioni.Eccezione;
import presentation.tier.FrontController;
import javafx.application.Application;
import javafx.stage.Stage;
public class Main extends Application {
public static final Stage stage = new Stage();
@Override
public void start(Stage primaryStage) throws Eccezione {
try {
FrontController fc = null;
fc = FrontController.getInstance();
fc.handleRequest("openViewStart", null);
} catch (Exception e) {
throw new Eccezione("Impossibile lanciare il programma..");
}
}
public static void main(String[] args) {
launch(args);
}
}
private void apriViewStart() throws Eccezione {
try {
AnchorPane root = (AnchorPane) FXMLLoader.load(getClass().getResource("/application/Login.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("/application/application.css").toExternalForm());
Main.stage.setTitle("CarLoan 1.0");
Main.stage.setScene(scene);
Main.stage.show();
} catch (Exception e) {
throw new Eccezione("Impossibile caricare l'interfaccia.");
}
}