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;
}
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();
}
}
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);
}
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);
}
}
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));
});
}
Aggregations