本文整理汇总了Java中javafx.fxml.FXMLLoader.load方法的典型用法代码示例。如果您正苦于以下问题:Java FXMLLoader.load方法的具体用法?Java FXMLLoader.load怎么用?Java FXMLLoader.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.fxml.FXMLLoader
的用法示例。
在下文中一共展示了FXMLLoader.load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openSubmitAction
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
@FXML
public void openSubmitAction(ActionEvent event) throws IOException {
Node node = (Node) event.getSource();
final Stage stage = (Stage) node.getScene().getWindow();
final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
final Scene hScene = new Scene(home);
Parent root = FXMLLoader.load(getClass().getResource("/fxml/Submit.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
root.setOnKeyPressed(new EventHandler<KeyEvent>() {
public void handle(KeyEvent ke) {
if (ke.getCode() == KeyCode.ESCAPE) {
System.out.println("Key Pressed: " + ke.getCode());
stage.setScene(hScene);
}
}
});
}
示例2: startInteractionList
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public static ListController startInteractionList(List<Interaction> listA , Saveable s) throws Exception {
log.debug("static startInteractionList called.");
FXMLLoader loader = new FXMLLoader();
loader.setLocation(ListController.class.getResource("interactionList.fxml"));
VBox rootLayout = (VBox)loader.load();
ListController cr = (ListController)loader.getController();
cr.start(rootLayout, listA, s);
started = true;
return cr;
}
示例3: start
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
try {
// Load root layout from fxml file.
FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml/ui_mockup.fxml"));
LMSFxController controller = new LMSFxController();
controller.setParent(primaryStage);
loader.setController(controller);
rootLayout = loader.load();
primaryStage.setTitle("LMSGrabber");
// Show the scene containing the root layout.
Scene scene = new Scene(rootLayout);
primaryStage.setScene(scene);
primaryStage.show();
primaryStage.setOnHiding(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
Platform.runLater(new Runnable() {
@Override
public void run() {
System.exit(0);
}
});
}
});
} catch (IOException e) {
logger.error("IOException", e);
}
}
示例4: WebBrowserTabController
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
* Constructor
*
* @param tab
* @param firstWebSite
*/
public WebBrowserTabController(WebBrowserController webBrowserController, Tab tab, String firstWebSite) {
this.webBrowserController = webBrowserController;
this.tab = tab;
this.firstWebSite = firstWebSite;
this.tab.setContent(this);
// ------------------------------------FXMLLOADER ----------------------------------------
FXMLLoader loader = new FXMLLoader(getClass().getResource(InfoTool.FXMLS + "WebBrowserTabController.fxml"));
loader.setController(this);
loader.setRoot(this);
try {
loader.load();
} catch (IOException ex) {
logger.log(Level.SEVERE, "", ex);
}
}
示例5: MessageCollectionPresentation
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public MessageCollectionPresentation(final Component component, final ObservableList<CodeAnalysis.Message> messages) {
this.messages = messages;
final URL location = this.getClass().getResource("MessageCollectionPresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(location.openStream());
initializeHeadline(component);
initializeLine();
initializeErrorsListener();
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例6: goToSignIn
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public void goToSignIn(double positionX, double positionY) {
try {
Stage SignInStage = new Stage();
Parent root = FXMLLoader.load(getClass().getResource("/view/SignIn.fxml"));
Scene scene = new Scene(root,800,550);
scene.getStylesheets().add(getClass().getResource("/css/SignIn.css").toExternalForm());
SignInStage.setScene(scene);
SignInStage.setResizable(false);
SignInStage.getIcons().add(new Image(getClass().getResourceAsStream("/imges/purse.png")));
SignInStage.setTitle("Money Manager");
SignInStage.setX(positionX);
SignInStage.setY(positionY);
SignInStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
示例7: btnDeleteAction
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
@FXML
private void btnDeleteAction()
{
try
{
FXMLLoader loader = new FXMLLoader(MainDisplay.class.getResource("/fxml/DeleteResultDialog.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.initStyle(StageStyle.UNDECORATED);
stage.setScene(scene);
stage.show();
Node node = scene.lookup("#txtArea");
if(node instanceof TextArea)
{
TextArea textArea = (TextArea)node;
DeleteTask task = new DeleteTask(dataContainer);
textArea.textProperty().bind(task.valueProperty());
Thread th = new Thread(task);
th.setDaemon(true);
th.start();
}
else
throw new IOException("Unable to find \"TextArea\" node");
}
catch(IOException e)
{
e.printStackTrace();
}
}
示例8: addActivity
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
* Display the 'Add Activity' window
*
* @return newly created Activity
*/
public Activity addActivity() throws Exception
{
ActivityController ac = new ActivityController();
// Load in the .fxml file:
FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/Activity.fxml"));
loader.setController(ac);
Parent root = loader.load();
// Set the scene:
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.setScene(new Scene(root, 550, 358));
stage.setTitle("New Activity");
stage.resizableProperty().setValue(false);
stage.getIcons().add(new Image("file:icon.png"));
stage.showAndWait();
// Add the Activity to the StudyPlanner
if (ac.isSuccess())
return ac.getActivity();
return null;
}
示例9: createSearchList
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public static SearchList createSearchList(EntitiesToSearch t, Openable ol) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(SearchList.class.getResource("searchList.fxml"));
VBox n = (VBox) fxmlLoader.load();
SearchList sl = fxmlLoader.getController();
sl.start(t, ol, n);
return sl;
}
示例10: start
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
stage.setTitle("Calculator");
stage.setResizable(false);
stage.setScene(scene);
stage.show();
}
示例11: UndoRedoHistoryPresentation
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public UndoRedoHistoryPresentation() {
final URL location = this.getClass().getResource("UndoRedoHistoryPresentation.fxml");
final FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(location);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
try {
fxmlLoader.setRoot(this);
fxmlLoader.load(location.openStream());
} catch (final IOException ioe) {
throw new IllegalStateException(ioe);
}
}
示例12: start
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
@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, 600, 400));
primaryStage.show();
}
示例13: newInstance
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public static AnnotationEditorPaneController newInstance() {
final ResourceBundle bundle = Initializer.getToolBox().getI18nBundle();
FXMLLoader loader = new FXMLLoader(AnnotationEditorPaneController.class
.getResource("/fxml/AnnotationEditorPane.fxml"), bundle);
try {
loader.load();
return loader.getController();
}
catch (Exception e) {
throw new RuntimeException("Failed to load RowEditorPane from FXML", e);
}
}
示例14: loadScene
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
private static void loadScene(SceneName sceneName, String fxmlResource) {
try {
FXMLLoader loader = new FXMLLoader(SceneNavigator.class.getResource(fxmlResource));
Pane pane = loader.load();
Scene scene = new Scene(pane);
scenes.put(sceneName, scene);
controllers.put(sceneName, loader.getController());
} catch (IOException e) {
e.printStackTrace();
}
}
示例15: start
import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception
{
Parent root =
FXMLLoader.load(getClass().getResource("CoverViewer.fxml"));
Scene scene = new Scene(root);
stage.setTitle("Cover Viewer");
stage.setScene(scene);
stage.show();
}