use of javafx.fxml.FXMLLoader in project Smartcity-Smarthouse by TechnionYP5777.
the class Controller method openConfiguration.
private void openConfiguration(Integer position) {
try {
URL location = getClass().getClassLoader().getResource("dashboard_configuration_ui.fxml");
// System.out.println(location);todo: ELIA why is this the location?
final FXMLLoader fxmlLoader = new FXMLLoader(location);
final Parent root1 = (Parent) fxmlLoader.load();
final Stage stage = new Stage();
ConfigurationController controller = fxmlLoader.getController();
controller.SetCallback(() -> updateTile(controller.getChosenType(), controller.getChosenPath(), position));
stage.setScene(new Scene(root1));
stage.show();
} catch (final Exception $) {
// TODO: handle error
System.out.println("Oops...");
$.printStackTrace();
}
}
use of javafx.fxml.FXMLLoader in project VocabHunter by VocabHunter.
the class ProgressProvider method get.
@Override
public ControllerAndView<ProgressController, Node> get() {
FXMLLoader loader = loaderProvider.get();
Node root = ViewFxml.PROGRESS.loadNode(loader);
ProgressController controller = loader.getController();
return new ControllerAndView<>(controller, root);
}
use of javafx.fxml.FXMLLoader in project Entitas-Java by Rubentxu.
the class CodeGeneratorJFX method start.
@Override
public void start(Stage primaryStage) throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("EntitasGenerator.fxml"));
Parent root = loader.load();
primaryStage.setTitle("CodeGenerator");
primaryStage.setScene(new Scene(root, 560, 575));
primaryStage.setResizable(false);
primaryStage.show();
stage = primaryStage;
}
use of javafx.fxml.FXMLLoader in project fxexperience2 by EricCanull.
the class ColorPickerControl method initialize.
/**
* Private
*/
private void initialize() {
final FXMLLoader loader = new FXMLLoader();
//NOI18N
loader.setLocation(ColorPickerControl.class.getResource("/fxml/FXMLColorPicker.fxml"));
loader.setController(this);
loader.setRoot(this);
try {
loader.load();
} catch (IOException ex) {
Logger.getLogger(ColorPickerControl.class.getName()).log(Level.SEVERE, null, ex);
}
assert hue_slider != null;
assert picker_region != null;
assert hue_textfield != null;
assert saturation_textfield != null;
assert brightness_textfield != null;
assert alpha_textfield != null;
assert red_textfield != null;
assert green_textfield != null;
assert blue_textfield != null;
assert alpha_slider != null;
// Make the grad for hue slider
hue_slider.setStyle(makeHueSliderCSS());
// Investigate why height + width listeners do not work
// Indeed, the picker_handle_stackpane bounds may still be null at this point
// UPDATE BELOW TO BE CALLED ONCE ONLY AT DISPLAY TIME
picker_region.boundsInParentProperty().addListener((ov, oldb, newb) -> {
picker_scrollpane.setHvalue(0.5);
picker_scrollpane.setVvalue(0.5);
// Init time only
final Paint paint = paintPickerController.getPaintProperty();
if (paint instanceof Color) {
updateUI((Color) paint);
} else if (paint instanceof LinearGradient || paint instanceof RadialGradient) {
final GradientPicker gradientPicker = paintPickerController.getGradientPicker();
final GradientPickerStop gradientPickerStop = gradientPicker.getSelectedStop();
// Update the color preview with the color of the selected stop
if (gradientPickerStop != null) {
updateUI(gradientPickerStop.getColor());
}
}
});
final ChangeListener<Boolean> onHSBFocusedChange = (ov, oldValue, newValue) -> {
if (newValue == false) {
// Update UI
final Color color = updateUI_OnHSBChange();
// Update model
setPaintProperty(color);
}
};
final ChangeListener<Boolean> onRGBFocusedChange = (ov, oldValue, newValue) -> {
if (newValue == false) {
// Update UI
final Color color = updateUI_OnRGBChange();
// Update model
setPaintProperty(color);
}
};
final ChangeListener<Boolean> onHexaFocusedChange = (ov, oldValue, newValue) -> {
if (newValue == false) {
try {
// Update UI
final Color color = updateUI_OnHexaChange();
// Update model
setPaintProperty(color);
} catch (IllegalArgumentException iae) {
handleHexaException();
}
}
};
// TextField ON FOCUS LOST event handler
hue_textfield.focusedProperty().addListener(onHSBFocusedChange);
saturation_textfield.focusedProperty().addListener(onHSBFocusedChange);
brightness_textfield.focusedProperty().addListener(onHSBFocusedChange);
alpha_textfield.focusedProperty().addListener(onHSBFocusedChange);
red_textfield.focusedProperty().addListener(onRGBFocusedChange);
green_textfield.focusedProperty().addListener(onRGBFocusedChange);
blue_textfield.focusedProperty().addListener(onRGBFocusedChange);
hexa_textfield.focusedProperty().addListener(onHexaFocusedChange);
// Slider ON VALUE CHANGE event handler
hue_slider.valueProperty().addListener((ov, oldValue, newValue) -> {
if (updating == true) {
return;
}
double hue = newValue.doubleValue();
// retrieve HSB TextFields values
double saturation = Double.valueOf(saturation_textfield.getText()) / 100.0;
double brightness = Double.valueOf(brightness_textfield.getText()) / 100.0;
double alpha = Double.valueOf(alpha_textfield.getText());
// Update UI
final Color color = updateUI(hue, saturation, brightness, alpha);
// Update model
setPaintProperty(color);
});
alpha_slider.valueProperty().addListener((ov, oldValue, newValue) -> {
if (updating == true) {
return;
}
double alpha = newValue.doubleValue();
// retrieve HSB TextFields values
double hue = Double.valueOf(hue_textfield.getText());
double saturation = Double.valueOf(saturation_textfield.getText()) / 100.0;
double brightness = Double.valueOf(brightness_textfield.getText()) / 100.0;
// Update UI
final Color color = updateUI(hue, saturation, brightness, alpha);
// Update model
setPaintProperty(color);
});
final ChangeListener<Boolean> liveUpdateListener = (ov, oldValue, newValue) -> paintPickerController.setLiveUpdate(newValue);
picker_region.pressedProperty().addListener(liveUpdateListener);
hue_slider.pressedProperty().addListener(liveUpdateListener);
alpha_slider.pressedProperty().addListener(liveUpdateListener);
}
use of javafx.fxml.FXMLLoader in project fxexperience2 by EricCanull.
the class PopupEditor method initialize.
private void initialize(Object startColor) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/FXMLPopupEditor.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
initializePopup(startColor);
}
Aggregations