下面列出了org.junit.jupiter.api.extension.ParameterResolutionException#javafx.fxml.FXMLLoader 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void start(Stage stage) throws IOException {
// set up the scene
FXMLLoader loader = new FXMLLoader(getClass().getResource("/orbit_the_camera_around_an_object/main.fxml"));
Parent root = loader.load();
controller = loader.getController();
Scene scene = new Scene(root);
// set up the stage
stage.setTitle("Orbit the Camera Around an Object Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(scene);
stage.show();
}
public static Stage createAboutStage(ResourceBundle bundle) {
try {
FXMLLoader loader = new FXMLLoader(OpenLabeler.class.getResource("/fxml/AboutPane.fxml"), bundle);
Parent root = loader.load();
Stage stage = new Stage();
stage.setTitle(bundle.getString("app.name"));
stage.focusedProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue) {
stage.close();
}
});
stage.initStyle(StageStyle.UNDECORATED);
stage.setResizable(false);
stage.setScene(new Scene(root));
return stage;
}
catch (Exception ex) {
LOG.log(Level.WARNING, "Failed to load ICNS file", ex);
}
return null;
}
private void initRecordingList() {
assert (rootController != null);
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Archivo.class.getResource("view/RecordingList.fxml"));
recordingListController = new RecordingListController(this);
loader.setController(recordingListController);
Pane recordingList = loader.load();
rootController.getMainGrid().add(recordingList, 0, 0);
rootController.setMenuBindings(recordingListController);
recordingListController.startTivoSearch();
} catch (IOException e) {
logger.error("Error initializing recording list: ", e);
}
}
@Override
protected void updateItem(T item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null || !(Boolean) item) {
setText(null);
setGraphic(null);
} else {
try {
String fileName = Resources.FXML + "PlayingIcon.fxml";
FXMLLoader loader = new FXMLLoader(this.getClass().getResource(fileName));
Pane pane = loader.load();
setGraphic(pane);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
@Override
public void start(Stage stage) throws Exception {
long time = System.currentTimeMillis();
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/loading.fxml"));
Parent root = fxmlLoader.load();
Scene scene = new Scene(root);
stage.initStyle(StageStyle.UNDECORATED);
stage.setAlwaysOnTop(true);
stage.setScene(scene);
stage.setTitle("启动中");
stage.getIcons().add(new Image(getClass().getResourceAsStream("/skin/icon.png")));
stage.show();
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug");
LoadingController lc = fxmlLoader.getController();
ApplicationStageManager.putStageAndController(ApplicationStageManager.StateAndController.LOADING, stage, lc);
ApplicationStageManager.setApplication(this);
LOGGER.info("启动页加载耗时:" + (System.currentTimeMillis() - time) + "毫秒");
new Thread(() -> {
Platform.runLater(() -> {
startMainApp(stage);
});
}).start();
}
@FXML
protected void manageHistories() {
try {
FXMLLoader fxmlLoader = new FXMLLoader(FxmlStage.class.getResource(
CommonValues.WebBrowserHistoryFxml), AppVariables.currentBundle);
Pane pane = fxmlLoader.load();
Tab tab = new Tab(message("ManageHistories"));
ImageView tabImage = new ImageView("img/MyBox.png");
tabImage.setFitWidth(20);
tabImage.setFitHeight(20);
tab.setGraphic(tabImage);
tab.setContent(pane);
tabPane.getTabs().add(tab);
tabPane.getSelectionModel().select(tab);
WebBrowserHistoryController controller = (WebBrowserHistoryController) fxmlLoader.getController();
controller.parent = this;
} catch (Exception e) {
logger.error(e.toString());
}
}
private Stage createStage(Stage mainStage) {
FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("event-log"));
loader.setController(this);
final Stage dialog = new Stage();
dialog.initOwner(mainStage.getScene().getWindow());
dialog.initModality(Modality.NONE);
Parent root;
try {
root = loader.load();
} catch (IOException e) {
throw new IllegalStateException(e);
}
Scene scene = new Scene(root);
dialog.setScene(scene);
return dialog;
}
/**
* 打开一个新窗口
*
* @param fxmlUrl fxml文件的url
* @param isShowTitle 是否显示title
* @return Stage,如果出现异常返回null
*/
public static Stage newWindow(URL fxmlUrl, boolean isShowTitle){
try {
Stage stage = new Stage();
if (!isShowTitle){
setNoBroder(stage);
}
// 背景透明
stage.initStyle(StageStyle.TRANSPARENT);
Parent layout = FXMLLoader.load(fxmlUrl);
Scene scene = new Scene(layout, Color.TRANSPARENT);
stage.setScene(scene);
// 在屏幕中间
stage.centerOnScreen();
return stage;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
public void start(Stage stage) throws Exception {
// set up the scene
FXMLLoader loader = new FXMLLoader(getClass().getResource("/trace_a_utility_network/main.fxml"));
Parent root = loader.load();
controller = loader.getController();
Scene scene = new Scene(root);
// set title, size and add scene to stage
stage.setTitle("Trace a Utility Network Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(scene);
stage.show();
}
private RemoteMenuController showConfigChooser(MenuTree tree) throws Exception {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/remoteSelector.fxml"));
BorderPane pane = loader.load();
RemoteSelectorController controller = loader.getController();
controller.init(tree);
Stage dialogStage = new Stage();
dialogStage.getIcons().add(new Image(getClass().getResourceAsStream("/controller-icon.png")));
dialogStage.setTitle("Connect to tcMenu device");
dialogStage.initModality(Modality.WINDOW_MODAL);
dialogStage.initOwner(null);
Scene scene = new Scene(pane);
dialogStage.setScene(scene);
dialogStage.showAndWait();
return controller.getResult();
}
@FXML
private void changePasswordAction(ActionEvent event)
{
mainTopAnchorPane.setEffect(new BoxBlur());
passwordStage = new Stage();
passwordStage.setOnCloseRequest(new EventHandler<WindowEvent>()
{
@Override
public void handle(WindowEvent t)
{
mainTopAnchorPane.effectProperty().setValue(null);
}
});
passwordStage.setTitle("Change Password");
passwordStage.initModality(Modality.APPLICATION_MODAL);
passwordStage.initStyle(StageStyle.UTILITY);
passwordStage.setResizable(false);
try
{
Parent passwordParent = FXMLLoader.load(getClass().getResource("changepassword.fxml"));
passwordStage.setScene(new Scene(passwordParent));
passwordStage.show();
} catch (IOException ex)
{
}
}
@Override
public void start(Stage stage) throws Exception {
applicationWindow = stage;
Locale locale = Locale.US;
ApplicationState.getInstance().setResourceBundle(ResourceBundle.getBundle("Bundle", locale));
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/App.fxml"));
loader.setResources(ApplicationState.getInstance().getResourceBundle());
loader.load();
Parent root = loader.getRoot();
appController = loader.getController();
Scene scene = new Scene(root);
scene.getStylesheets().add("/styles/Styles.css");
stage.setTitle(ApplicationState.getInstance().getResourceBundle().getString(APPLICATION_TITLE));
stage.setScene(scene);
stage.show();
stage.setOnCloseRequest(event -> {
ConnectionManager.getInstance().shutdown();
Platform.exit();
System.exit(0);
});
}
MessageDisplay() {
stage.setTitle("Messages");
stage.getIcons().addAll(new Image(getClass().getResourceAsStream("/icon32.png")),
new Image(getClass().getResourceAsStream("/icon22.png")),
new Image(getClass().getResourceAsStream("/icon16.png")));
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/message_display.fxml"));
fxmlLoader.setController(this);
try {
Scene scene = new Scene(fxmlLoader.load(), SCENE_WIDTH, SCENE_HEIGHT);
stage.setScene(scene);
} catch (Exception ex) {
DetailedAlert alert = new DetailedAlert(DetailedAlert.AlertType.ERROR);
alert.setTitle("Error");
alert.setHeaderText("Exception while loading MessageDisplay");
alert.setDetailsText(MessageLogger.getStackTrace(ex));
alert.showAndWait();
}
}
private void fillBox(int whichAct, VBox whichActBox, HashMap<Zone, ArrayList<Gem>> gemHash, ArrayList<Zone> zoneList) {
for(Zone z : zoneList){
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("questSplitPanel.fxml"));
AnchorPane con = fxmlLoader.load();
QuestSplitPanel_Controller controller = fxmlLoader.getController();
whichActBox.getChildren().add(con);
controller.load(z, gemHash.get(z), this);
tablinkers.add(new TabLinker(controller,z, whichAct - 1));
gemHash.get(z).forEach(gem -> m_gemNames.add(gem.getGemName()));
} catch (IOException ex) {
Logger.getLogger(QuestSplitPanel_Controller.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
}
}
}
/** Loads the FXML file with the given name, blurs out the main UI and puts this one on top. */
public <T> OverlayUI<T> overlayUI(String name) {
try {
checkGuiThread();
// Load the UI from disk.
URL location = GuiUtils.getResource(name);
FXMLLoader loader = new FXMLLoader(location);
Pane ui = loader.load();
T controller = loader.getController();
OverlayUI<T> pair = new OverlayUI<T>(ui, controller);
// Auto-magically set the overlayUI member, if it's there.
try {
if (controller != null)
controller.getClass().getField("overlayUI").set(controller, pair);
} catch (IllegalAccessException | NoSuchFieldException ignored) {
ignored.printStackTrace();
}
pair.show();
return pair;
} catch (IOException e) {
throw new RuntimeException(e); // Can't happen.
}
}
public PlayModeView() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/PlayModeView.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
boardView = new GameBoardView();
// setCenter(boardView);
loadingView = new LoadingBoardView();
setCenter(loadingView);
actionPromptView = new HumanActionPromptView();
//sidePane.getChildren().add(actionPromptView);
backButton.setOnAction(actionEvent -> NotificationProxy.sendNotification(GameNotification.MAIN_MENU));
sidePane.getChildren().setAll(actionPromptView, navigationPane);
}
public AboutDialog() throws IOException {
super(AlertType.NONE, null, ButtonType.CLOSE);
setTitle("About BlockMap");
setResizable(true);
initModality(Modality.APPLICATION_MODAL);
FXMLLoader loader = new FXMLLoader(getClass().getResource("aboutpane.fxml"));
loader.setController(this);
getDialogPane().setContent(loader.load());
getDialogPane().getStylesheets().add("/de/piegames/blockmap/gui/standalone/about/style.css");
aboutTitle.setText("BlockMap " + VersionProvider.VERSION);
@SuppressWarnings("serial")
List<Dependency> dependencies = new GsonBuilder().registerTypeAdapterFactory(new GsonJava8TypeAdapterFactory()).create().fromJson(
// TODO automate copying that file on dependency change
new InputStreamReader(getClass().getResourceAsStream("licenseReport.json")),
new TypeToken<List<Dependency>>() {
}.getType());
for (Dependency dependency : dependencies) {
this.dependencies.getChildren().add(new DependencyPane(dependency));
}
license.setText(LICENSE_TEXT);
}
public RootLayout() {
FXMLLoader fxmlLoader = new FXMLLoader(
getClass().getResource("/RootLayout.fxml")
);
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
}
@Override
public void start(Stage stage) throws IOException {
// set up the scene
FXMLLoader loader = new FXMLLoader(getClass().getResource("/sketch_on_map/main.fxml"));
Parent root = loader.load();
controller = loader.getController();
Scene scene = new Scene(root);
// set up the stage
stage.setTitle("Sketch on Map Sample");
stage.setWidth(1000);
stage.setHeight(700);
stage.setScene(scene);
stage.show();
}
private void showProperties(PathItem item) {
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource(ViewNames.PROPERTIES_VIEW));
loader.setController(new Properties(getItem()));
Parent root = loader.load();
// load UI on Application thread and show window
Runnable showStage = new Runnable() {
@Override
public void run() {
Scene scene = new Scene(root);
stage = new Stage();
stage.setTitle("Properties of "
+ getItem().getPath().getFileName());
stage.setScene(scene);
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
stage = null;
}
});
stage.show();
}
};
if (Platform.isFxApplicationThread()) {
showStage.run();
} else {
Platform.runLater(showStage);
}
} catch (IOException e) {
logger.warn("Exception while showing properties.", e);
}
}
public void callDefault(){
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getClassLoader().getResource("pokedex/view/Default.fxml"));
dynamic.getChildren().clear();
dynamic.getChildren().add((AnchorPane)loader.load());
controller = null;
} catch (IOException ex) {
Logger.getLogger(IndexController.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader fxmlLoader = new FXMLLoader(WoodlandMain.class.getResource("/fxml/Woodland.fxml"));
Parent p = fxmlLoader.load();
Scene scene = new Scene( p );
scene.getStylesheets().add( "css/woodland.css" );
primaryStage.setTitle("Woodland");
primaryStage.setScene( scene );
primaryStage.show();
}
@FXML
void btnStaffReg(ActionEvent event) {
try {
AnchorPane studentMgmt = FXMLLoader.load(getClass().getResource(("/sms/view/fxml/RegisterStaff.fxml")));
studentManagement.getChildren().setAll(studentMgmt);
}catch(IOException e){
System.out.println(e);
}
}
public void loginButtonAction() throws IOException {
String hostname = hostnameTextfield.getText();
int port = Integer.parseInt(portTextfield.getText());
String username = usernameTextfield.getText();
String picture = selectedPicture.getText();
FXMLLoader fmxlLoader = new FXMLLoader(getClass().getResource("/views/ChatView.fxml"));
Parent window = (Pane) fmxlLoader.load();
con = fmxlLoader.<ChatController>getController();
Listener listener = new Listener(hostname, port, username, picture, con);
Thread x = new Thread(listener);
x.start();
this.scene = new Scene(window);
}
public void socketGroupReplace(Gem add, Gem remove){
FXMLLoader loader = new FXMLLoader(getClass().getResource("/poe/level/fx/overlay/replace_socket_group_overlay.fxml"));
AnchorPane ap = null;
try {
ap = loader.load();
} catch (IOException ex) {
Logger.getLogger(GemOverlay_Controller.class.getName()).log(Level.SEVERE, null, ex);
}
loader.<Replace_socket_group_overlay_Controller>getController().load(add,remove);
gem_overlay_container.getChildren().add(ap);
}
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root, 300, 275));
primaryStage.show();
}
public Parent initialize(Stage stage) {
rootStage = stage;
FXMLLoader loader = ResourceTools.getFxmlConfig(View.INDEX);
try {
Parent parent = loader.load();
initMvc(loader);
rootParent = parent;
return parent;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("hellofx.fxml"));
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
@FXML
private void handleBookEditOption(ActionEvent event) {
//Fetch the selected row
Book selectedForEdit = tableView.getSelectionModel().getSelectedItem();
if (selectedForEdit == null) {
AlertMaker.showErrorMessage("No book selected", "Please select a book for edit.");
return;
}
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/library/assistant/ui/addbook/add_book.fxml"));
Parent parent = loader.load();
BookAddController controller = (BookAddController) loader.getController();
controller.inflateUI(selectedForEdit);
Stage stage = new Stage(StageStyle.DECORATED);
stage.setTitle("Edit Book");
stage.setScene(new Scene(parent));
stage.show();
LibraryAssistantUtil.setStageIcon(stage);
stage.setOnHiding((e) -> {
handleRefresh(new ActionEvent());
});
} catch (IOException ex) {
Logger.getLogger(MainController.class.getName()).log(Level.SEVERE, null, ex);
}
}
@FXML
void Back(ActionEvent event) {
try {
AnchorPane studentMgmt = FXMLLoader.load(getClass().getResource(("/sms/view/fxml/StaffManagement.fxml")));
root.getChildren().setAll(studentMgmt);
}catch(IOException e){
System.out.println(e);
}
}