Search in sources :

Example 1 with FXMLLoader

use of javafx.fxml.FXMLLoader in project PayFile by mikehearn.

the class GuiUtils method runAlert.

public static void runAlert(BiConsumer<Stage, AlertWindowController> setup) {
    // JavaFX doesn't actually have a standard alert template. Instead the Scene Builder app will create FXML
    // files for an alert window for you, and then you customise it as you see fit. I guess it makes sense in
    // an odd sort of way.
    Stage dialogStage = new Stage();
    dialogStage.initModality(Modality.APPLICATION_MODAL);
    FXMLLoader loader = new FXMLLoader(GuiUtils.class.getResource("alert.fxml"));
    Pane pane = evalUnchecked(() -> (Pane) loader.load());
    AlertWindowController controller = loader.getController();
    setup.accept(dialogStage, controller);
    dialogStage.setScene(new Scene(pane));
    dialogStage.showAndWait();
}
Also used : Stage(javafx.stage.Stage) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) Pane(javafx.scene.layout.Pane)

Example 2 with FXMLLoader

use of javafx.fxml.FXMLLoader in project cryptomator by cryptomator.

the class AbstractFXMLViewController method createFxmlLoader.

/**
	 * Creates a FXML loader used in {@link #loadFxml()}. This method can be overwritten for further loader customization.
	 * 
	 * @return Configured loader ready to load.
	 */
protected FXMLLoader createFxmlLoader() {
    final URL fxmlUrl = getFxmlResourceUrl();
    final ResourceBundle rb = getFxmlResourceBundle();
    final FXMLLoader loader = new FXMLLoader(fxmlUrl, rb);
    loader.setController(this);
    return loader;
}
Also used : ResourceBundle(java.util.ResourceBundle) FXMLLoader(javafx.fxml.FXMLLoader) URL(java.net.URL)

Example 3 with FXMLLoader

use of javafx.fxml.FXMLLoader in project fxexperience2 by EricCanull.

the class AbstractWindow method root.

public Parent root() throws IOException {
    FXMLLoader loader = new FXMLLoader(url(), bundle);
    loader.setController(controller);
    return loader.load();
}
Also used : FXMLLoader(javafx.fxml.FXMLLoader)

Example 4 with FXMLLoader

use of javafx.fxml.FXMLLoader in project Smartcity-Smarthouse by TechnionYP5777.

the class SmartHouseApplication method createFXMLLoader.

public FXMLLoader createFXMLLoader(final String fxmlFileName) {
    final URL url = getResource(fxmlFileName);
    final FXMLLoader fxmlLoader = new FXMLLoader(url);
    fxmlLoader.setClassLoader(getClass().getClassLoader());
    log.info("Creating FXML for app \"" + getApplicationName() + "\" (" + getClass().getName() + ") from: " + url);
    return fxmlLoader;
}
Also used : FXMLLoader(javafx.fxml.FXMLLoader) URL(java.net.URL)

Example 5 with FXMLLoader

use of javafx.fxml.FXMLLoader in project Smartcity-Smarthouse by TechnionYP5777.

the class SimulatorController method initialize.

@Override
public void initialize(final URL location, final ResourceBundle __) {
    FXMLLoader loader = new FXMLLoader(this.getClass().getResource("room_ui.fxml"));
    tab1.setText("Bedroom");
    try {
        tab1.setContent((Node) loader.load());
    } catch (final IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    bedroom = loader.getController();
    bedroom.setImageUrl("house.jpg").setLocation(Location.BEDROOM).setMainController(this);
    // user tab:
    loader = new FXMLLoader(this.getClass().getResource("room_ui.fxml"));
    tab2.setText("Bathroom");
    try {
        tab2.setContent((Node) loader.load());
    } catch (final IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    bathroom = loader.getController();
    bathroom.setImageUrl("house.jpg").setLocation(Location.BATHROOM).setMainController(this);
    // user tab:
    loader = new FXMLLoader(this.getClass().getResource("room_ui.fxml"));
    tab3.setText("Kitchen");
    try {
        tab3.setContent((Node) loader.load());
    } catch (final IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    kitchen = loader.getController();
    kitchen.setImageUrl("house.jpg").setLocation(Location.KITCHEN).setMainController(this);
    // user tab:
    loader = new FXMLLoader(this.getClass().getResource("room_ui.fxml"));
    tab4.setText("Livingroom");
    try {
        tab4.setContent((Node) loader.load());
    } catch (final IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    livingroom = loader.getController();
    livingroom.setImageUrl("house.jpg").setLocation(Location.LIVINGROOM).setMainController(this);
    loadSensorList();
}
Also used : IOException(java.io.IOException) FXMLLoader(javafx.fxml.FXMLLoader)

Aggregations

FXMLLoader (javafx.fxml.FXMLLoader)252 IOException (java.io.IOException)148 Scene (javafx.scene.Scene)120 Parent (javafx.scene.Parent)79 Stage (javafx.stage.Stage)64 FXML (javafx.fxml.FXML)46 URL (java.net.URL)43 Pane (javafx.scene.layout.Pane)34 BorderPane (javafx.scene.layout.BorderPane)30 AnchorPane (javafx.scene.layout.AnchorPane)24 ActionEvent (javafx.event.ActionEvent)19 ResourceBundle (java.util.ResourceBundle)16 Initializable (javafx.fxml.Initializable)14 JFXButton (com.jfoenix.controls.JFXButton)13 KeyFrame (javafx.animation.KeyFrame)13 Timeline (javafx.animation.Timeline)13 StackPane (javafx.scene.layout.StackPane)13 Duration (javafx.util.Duration)13 Level (java.util.logging.Level)12 Logger (java.util.logging.Logger)12