Search in sources :

Example 76 with FXMLLoader

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

the class SmartHouseApplication method setContentView.

// [end]
// [start] Public - Services to application developers
/**
     * Set the fxml file that will be used
     * 
     * @param location
     *            of the fxml file
     * @return
     */
public <T extends Initializable> T setContentView(final String fxmlFileName) {
    try {
        final FXMLLoader fxmlLoader = createFXMLLoader(fxmlFileName);
        fxmlLoader.setClassLoader(getClass().getClassLoader());
        rootNode = fxmlLoader.load();
        return fxmlLoader.getController();
    } catch (final Exception e) {
        rootNode = null;
        log.error("Couldn't load the application's fxml. The rootNode is null", e);
    }
    return null;
}
Also used : FXMLLoader(javafx.fxml.FXMLLoader)

Example 77 with FXMLLoader

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

the class TempDashboard method openConfiguration.

public void openConfiguration() {
    System.out.println("Clicked!");
    try {
        final FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("dashboard_configuration_ui.fxml"));
        final Parent root1 = (Parent) fxmlLoader.load();
        final Stage stage = new Stage();
        stage.setScene(new Scene(root1));
        stage.show();
        ConfigurationController controller = fxmlLoader.getController();
    // controller.setComboBox();
    // controller.setParentController(this);
    // ((ConfigController)
    // fxmlLoader.getController()).subscribe(StoveAppController.this);
    } catch (final Exception $) {
        // TODO: handle error
        System.out.println("Oops...");
        $.printStackTrace();
    }
}
Also used : Parent(javafx.scene.Parent) Stage(javafx.stage.Stage) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader)

Example 78 with FXMLLoader

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

the class SessionProvider method get.

@Override
public ControllerAndView<SessionController, Node> get() {
    FXMLLoader loader = loaderProvider.get();
    Node root = ViewFxml.SESSION.loadNode(loader);
    SessionController controller = loader.getController();
    return new ControllerAndView<>(controller, root);
}
Also used : Node(javafx.scene.Node) ControllerAndView(io.github.vocabhunter.gui.common.ControllerAndView) FXMLLoader(javafx.fxml.FXMLLoader)

Example 79 with FXMLLoader

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

the class BaseFilterHandler method show.

public void show(final FilterFileModel model, final Runnable onSave) {
    Stage stage = new Stage();
    FXMLLoader loader = loaderProvider.get();
    Parent root = viewFxml.loadNode(loader);
    T controller = loader.getController();
    try {
        controller.initialise(stage, model, onSave);
        WindowTool.setupModal(stage, root, windowTitle);
    } catch (final RuntimeException e) {
        FileErrorTool.open(model.getFile(), e);
    }
}
Also used : Parent(javafx.scene.Parent) Stage(javafx.stage.Stage) FXMLLoader(javafx.fxml.FXMLLoader)

Example 80 with FXMLLoader

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

the class SliderControl method initialize.

/**
     * Private
     */
private void initialize(String text, double min, double max, double initVal) {
    final FXMLLoader loader = new FXMLLoader();
    //NOI18N
    loader.setLocation(SliderControl.class.getResource("/fxml/FXMLSliderControl.fxml"));
    loader.setController(this);
    loader.setRoot(this);
    try {
        loader.load();
    } catch (IOException ex) {
        Logger.getLogger(GradientPicker.class.getName()).log(Level.SEVERE, null, ex);
    }
    assert slider_label != null;
    assert slider_slider != null;
    assert slider_textfield != null;
    slider_label.setText(text);
    slider_slider.setMin(min);
    slider_slider.setMax(max);
    slider_slider.setValue(initVal);
    slider_textfield.setText(Double.toString(initVal));
    slider_slider.valueProperty().addListener((ov, oldValue, newValue) -> {
        double rounded = round(newValue.doubleValue(), roundingFactor);
        slider_textfield.setText(Double.toString(rounded));
    });
}
Also used : GradientPicker(com.fxexperience.javafx.scene.control.gradientpicker.GradientPicker) IOException(java.io.IOException) FXMLLoader(javafx.fxml.FXMLLoader)

Aggregations

FXMLLoader (javafx.fxml.FXMLLoader)113 IOException (java.io.IOException)67 Scene (javafx.scene.Scene)37 Parent (javafx.scene.Parent)33 Stage (javafx.stage.Stage)28 URL (java.net.URL)24 FXML (javafx.fxml.FXML)24 Pane (javafx.scene.layout.Pane)24 ActionEvent (javafx.event.ActionEvent)18 AnchorPane (javafx.scene.layout.AnchorPane)18 ResourceBundle (java.util.ResourceBundle)16 BorderPane (javafx.scene.layout.BorderPane)16 Initializable (javafx.fxml.Initializable)14 JFXButton (com.jfoenix.controls.JFXButton)13 StackPane (javafx.scene.layout.StackPane)13 KeyFrame (javafx.animation.KeyFrame)12 Timeline (javafx.animation.Timeline)12 Duration (javafx.util.Duration)12 Level (java.util.logging.Level)11 Logger (java.util.logging.Logger)11