когда я запускаю свой код, я получаю пустое белое окно.
Это для приложения, работающего с javaFX.После входа в систему с помощью вида View я хочу получить представление, щелкнув элемент меню.
package View;
import..
public class AccountManagerView implements Initializable{
private AccountManagerController controller;
//...
@FXML
void onNachrichtenClicked() throws OperationNotSupportedException {
controller.loadMessagingSystem();
}
public void loadMessagingSystemView() throws OperationNotSupportedException {
MessagingSystemView messagingSystemView = new MessagingSystemView();
Scene scene = messagingSystemView.getMainScene();
Stage stage = new Stage();
stage.setScene(scene);
stage.show();
}
}
package Controller;
import View.AccountManagerView;
import javax.naming.OperationNotSupportedException;
public class AccountManagerController {
private AccountManagerView view;
public void loadMessagingSystem() throws OperationNotSupportedException {
view.loadMessagingSystemView();
}
}
package View;
import Controller.*;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javax.naming.OperationNotSupportedException;
public class MessagingSystemView {
public static MessagingSystemView defaultView = new MessagingSystemView();
private static boolean chatViewInitialized =false;
private ModelAccess modelAccess = new ModelAccess();
private final String CHAT_FXML = "MessagingSystem.fxml";
private final String MAIN_CSS = "Stylesheet.css";
private MessagingSystemMainController messageSystemMainController;
private MessagingSystemDetailsController messageSystemDetailsController;
public Scene getMainScene() throws OperationNotSupportedException {
if (!chatViewInitialized) {
messageSystemMainController = new MessagingSystemMainController(modelAccess);
chatViewInitialized = true;
return initializeScene(CHAT_FXML, messageSystemMainController);
}else{
throw new OperationNotSupportedException("Main scene already initialized!");
}
}
private Scene initializeScene(String fxmlPath, MessagingSystemAbstractController controller) {
FXMLLoader loader;
Parent parent;
Scene scene;
try {
loader = new FXMLLoader(getClass().getResource(fxmlPath));
loader.setController(controller);
parent = loader.load();
} catch (Exception e) {
return null;
}
scene = new Scene(parent);
scene.getStylesheets().add(getClass().getResource(MAIN_CSS).toExternalForm());
return scene;
}
}
Когда я запускаю свой код, я получаю следующеев моей консоли:
Май 22, 2019 18:50:08 com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged INFO: Не удалось найти таблицу стилей: file: / Users / theogavriilidis / SEP / repo_gruppe_4 / target /stylesheet.css