当前位置: 首页>>代码示例>>Java>>正文


Java FXMLLoader.load方法代码示例

本文整理汇总了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);
            }
        }
    });
}
 
开发者ID:dewarian,项目名称:FYS_T3,代码行数:21,代码来源:submitController.java

示例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;
}
 
开发者ID:ForJ-Latech,项目名称:fwm,代码行数:11,代码来源:ListController.java

示例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);
  }

}
 
开发者ID:LMSGrabber,项目名称:LMSGrabber,代码行数:38,代码来源:App.java

示例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);
	}
}
 
开发者ID:goxr3plus,项目名称:JavaFX-Web-Browser,代码行数:24,代码来源:WebBrowserTabController.java

示例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);
    }
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:23,代码来源:MessageCollectionPresentation.java

示例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();
	}
}
 
开发者ID:krHasan,项目名称:Money-Manager,代码行数:18,代码来源:GoToOperation.java

示例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();
	}
}
 
开发者ID:tengai650,项目名称:SnapDup,代码行数:39,代码来源:MainDisplay.java

示例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;
}
 
开发者ID:Alienturnedhuman,项目名称:PearPlanner,代码行数:29,代码来源:UIManager.java

示例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;
}
 
开发者ID:ForJ-Latech,项目名称:fwm,代码行数:9,代码来源:SearchList.java

示例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();
}
 
开发者ID:MrunalSawant,项目名称:Calculator-JavaFX,代码行数:11,代码来源:CalculatorJavaFx.java

示例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);
    }
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:16,代码来源:UndoRedoHistoryPresentation.java

示例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();
}
 
开发者ID:katzrkool,项目名称:countingByOnesJava,代码行数:8,代码来源:Main.java

示例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);
    }
}
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:14,代码来源:AnnotationEditorPaneController.java

示例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();
    }
}
 
开发者ID:aaruff,项目名称:JavaFX8-SceneNavigationBoilerplate,代码行数:12,代码来源:SceneNavigator.java

示例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();
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:12,代码来源:CoverViewer.java


注:本文中的javafx.fxml.FXMLLoader.load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。