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


Java FXMLLoader.setController方法代码示例

本文整理汇总了Java中javafx.fxml.FXMLLoader.setController方法的典型用法代码示例。如果您正苦于以下问题:Java FXMLLoader.setController方法的具体用法?Java FXMLLoader.setController怎么用?Java FXMLLoader.setController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.fxml.FXMLLoader的用法示例。


在下文中一共展示了FXMLLoader.setController方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: taskDetails

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
 * Displays the Task details page
 *
 * @param task for which the details should be displayed.
 * @throws IOException
 */
public void taskDetails(Task task) throws IOException
{
    TaskController tc = new TaskController(task);

    // Load in the .fxml file:
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/Task.fxml"));
    loader.setController(tc);
    Parent root = loader.load();

    // Set the scene:
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setScene(new Scene(root, 550, 558));
    stage.setTitle("Task");
    stage.resizableProperty().setValue(false);
    stage.getIcons().add(new Image("file:icon.png"));
    stage.showAndWait();
}
 
开发者ID:Alienturnedhuman,项目名称:PearPlanner,代码行数:25,代码来源:UIManager.java

示例2: showLaunchingScreen

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
   * Launch and show the launching screen
   */
  public void showLaunchingScreen(){
Stage promptWindow = new Stage();
promptWindow.setTitle(get_langBundle().getString("welcome"));
try {
	FXMLLoader loader = new FXMLLoader();
          loader.setLocation(getClass().getResource("/view/LaunchingScreen.fxml"));
          loader.setController(new LaunchingScreenController(this,promptWindow));
          loader.setResources(ResourceBundle.getBundle("bundles.Lang", _locale));
          BorderPane layout = (BorderPane) loader.load();
	Scene launchingScene = new Scene(layout,404,250);
	//ENLEVER LE COMMENTAIRE POUR ACTIVER LA BETA CSS FLAT DESIGN
	//rootLayout.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
	promptWindow.setScene(launchingScene);
	promptWindow.showAndWait();
	
	// if project empty -> launch interview creation
	if(this.getCurrentProject().getEntretiens().isEmpty()){
		rootLayout.setCenter(null);
		this.getRootLayoutController().newInterview();
	}
} catch (IOException e) {
	e.printStackTrace();
}
  }
 
开发者ID:coco35700,项目名称:uPMT,代码行数:28,代码来源:Main.java

示例3: milestoneDetails

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
 * Displays the Milestone details page
 *
 * @param milestone Milestone for which the details should be shown.
 */
public void milestoneDetails(Milestone milestone) throws IOException
{
    MilestoneController mc = new MilestoneController(milestone);

    // Load in the .fxml file:
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/Milestone.fxml"));
    loader.setController(mc);
    Parent root = loader.load();

    // Set the scene:
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setScene(new Scene(root, 550, 355));
    stage.setTitle("Milestone");
    stage.resizableProperty().setValue(false);
    stage.getIcons().add(new Image("file:icon.png"));
    stage.showAndWait();
}
 
开发者ID:Alienturnedhuman,项目名称:PearPlanner,代码行数:24,代码来源:UIManager.java

示例4: addMilestone

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
/**
 * Displays the 'Add Milestone' window.
 *
 * @return newly created Milestone object.
 */
public Milestone addMilestone() throws IOException
{
    MilestoneController mc = new MilestoneController();

    // Load in the .fxml file:
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/Milestone.fxml"));
    loader.setController(mc);
    Parent root = loader.load();

    // Set the scene:
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setScene(new Scene(root, 550, 355));
    stage.setTitle("Milestone");
    stage.resizableProperty().setValue(false);
    stage.getIcons().add(new Image("file:icon.png"));
    stage.showAndWait();

    // Add the Milestone to the StudyPlanner
    if (mc.isSuccess())
        return mc.getMilestone();
    return null;
}
 
开发者ID:Alienturnedhuman,项目名称:PearPlanner,代码行数:29,代码来源:UIManager.java

示例5: showDialog

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public boolean showDialog() {
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/gui/conflict/resolve-conflicts-view.fxml"));
    try {
        loader.setController(conflictManagerController);
        DialogPane root = loader.load();
        root.getStylesheets().add(getClass().getResource("/gui/conflict/resolve-conflicts-view.css").toExternalForm());

        Alert alert = new Alert(Alert.AlertType.WARNING);
        alert.setTitle("Resolve conflicts");
        alert.setResizable(true);
        alert.setDialogPane(root);
        alert.initModality(Modality.WINDOW_MODAL);

        Window window = alert.getDialogPane().getScene().getWindow();
        window.setOnCloseRequest(event -> window.hide());

        alert.showAndWait();

    } catch (IOException e) {
        e.printStackTrace();
    }
    return conflictManagerController.isFinishedSuccessfully();
}
 
开发者ID:adr,项目名称:eadlsync,代码行数:24,代码来源:ConflictManagerView.java

示例6: LogTab

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public LogTab(String name, Process process) {
	setText(name);

	this.process = process;
	URL loc = Thread.currentThread().getContextClassLoader().getResource("gui/log_tab.fxml");
	FXMLLoader fxmlLoader = new FXMLLoader(loc);
	fxmlLoader.setRoot(this);
	fxmlLoader.setController(this);
	try {
		fxmlLoader.load();
	} catch (IOException exception) {
		throw new RuntimeException(exception);
	}
	kill.setOnAction(event -> kill());
	clear.setOnAction(event -> textArea.clear());
	upload.setOnAction(event -> MiscUtil.uploadLog(textArea.getText()));
	textArea.setTextFormatter(new TextFormatter<String>(change ->
		change.getControlNewText().length() <= MAX_CHARS ? change : null));
	setOnCloseRequest(this::close);
}
 
开发者ID:HearthProject,项目名称:OneClient,代码行数:21,代码来源:LogController.java

示例7: 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

示例8: start

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception
{

    AccountController accountControl = new AccountController();
    FXMLLoader loader = new FXMLLoader(getClass().getResource("CreateAccount.fxml"));
    loader.setController(accountControl);
    Parent root = loader.load();

    stage.setOnCloseRequest(e -> {
        Platform.exit();
        System.exit(0);
    });

    Scene scene = new Scene(root, 550, 232);

    stage.setScene(scene);

    stage.show();
}
 
开发者ID:Alienturnedhuman,项目名称:PearPlanner,代码行数:21,代码来源:FXBase.java

示例9: ClickableBitcoinAddress

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public ClickableBitcoinAddress() {
    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("bitcoin_address.fxml"));
        loader.setRoot(this);
        loader.setController(this);
        // The following line is supposed to help Scene Builder, although it doesn't seem to be needed for me.
        loader.setClassLoader(getClass().getClassLoader());
        loader.load();

        AwesomeDude.setIcon(copyWidget, AwesomeIcon.COPY);
        Tooltip.install(copyWidget, new Tooltip("Copy address to clipboard"));

        AwesomeDude.setIcon(qrCode, AwesomeIcon.QRCODE);
        Tooltip.install(qrCode, new Tooltip("Show a barcode scannable with a mobile phone for this address"));

        addressStr = convert(address);
        addressLabel.textProperty().bind(addressStr);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:22,代码来源:ClickableBitcoinAddress.java

示例10: initTrayNotification

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
private void initTrayNotification(String title, String message, Notification type) {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getClassLoader().getResource("fxml/notification.fxml"));

    fxmlLoader.setController(this);
    try {
        fxmlLoader.load();
    } catch (IOException e) {
        e.printStackTrace();
        return;
    }

    initStage();
    initAnimations();

    setTray(title, message, type);
}
 
开发者ID:victorward,项目名称:recruitervision,代码行数:17,代码来源:NotificationController.java

示例11: loadFxml

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
private void loadFxml() {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(FXML_NAME));
    fxmlLoader.setController(this);
    try {
        fxmlLoader.load();
    } catch (IOException ignored) {
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:9,代码来源:TimelineEditorComponent.java

示例12: ServiceControl

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public ServiceControl(ServerControl serverControl, ServiceModel service) {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("fxml/service.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
        fxmlLoader.load();
    } catch (IOException exception) {
        throw new RuntimeException(exception);
    }

    this.serverControl = serverControl;
    this.service = service;

    final ConfigurationModel configuration = App.getConfiguration();

    final String actionName = service.getActionName();
    action = configuration.getActionByName(actionName);

    this.setText(action.getDescription());

    final ObservableList<Node> formEntriesControls = formEntriesContainer.getChildren();

    formEntryControls = buildUserParamsControls();
    formEntriesControls.addAll(formEntryControls);

    if (formEntriesControls.isEmpty()) {
        formEntriesContainer.getChildren().add(0, new Label("Nothing to configure for this service."));
    }
}
 
开发者ID:micheledv,项目名称:passepartout,代码行数:31,代码来源:ServiceControl.java

示例13: CustomControl

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
public CustomControl() {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("custom_control.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);
    
    try {
        fxmlLoader.load();            
    } catch (IOException exception) {
        throw new RuntimeException(exception);
    }
}
 
开发者ID:jmblixt3,项目名称:Clash-Royale,代码行数:12,代码来源:CustomControl.java

示例14: loadFXML

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
private void loadFXML() {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(DIALOG_HEADER_FXML));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
        fxmlLoader.load();
    } catch (IOException exception) {
        throw new RuntimeException(exception);
    }
}
 
开发者ID:AntonioGabrielAndrade,项目名称:LIRE-Lab,代码行数:12,代码来源:DialogHeader.java

示例15: loadFXML

import javafx.fxml.FXMLLoader; //导入方法依赖的package包/类
protected void loadFXML() {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(SINGLE_IMAGE_GRID_FXML));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
        fxmlLoader.load();
    } catch (IOException exception) {
        throw new RuntimeException(exception);
    }
}
 
开发者ID:AntonioGabrielAndrade,项目名称:LIRE-Lab,代码行数:12,代码来源:SingleImageGrid.java


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