use of javafx.scene.control.ColorPicker in project FXGL by AlmasB.
the class ParticleSystemSample method initUI.
@Override
protected void initUI() {
Spinner<Integer> spinnerNumParticles = new Spinner<>(0, 100, 15, 1);
emitter.numParticlesProperty().bind(spinnerNumParticles.valueProperty());
Spinner<Double> spinnerRate = new Spinner<>(0.0, 1.0, 1.0, 0.05);
emitter.emissionRateProperty().bind(spinnerRate.valueProperty());
Spinner<Double> spinnerMinSize = new Spinner<>(1.0, 100.0, 9.0, 1);
emitter.minSizeProperty().bind(spinnerMinSize.valueProperty());
Spinner<Double> spinnerMaxSize = new Spinner<>(1.0, 100.0, 12.0, 1);
emitter.maxSizeProperty().bind(spinnerMaxSize.valueProperty());
Spinner<Double> spinnerVelX = new Spinner<>(-500.0, 500.0, 0.0, 10);
Spinner<Double> spinnerVelY = new Spinner<>(-500.0, 500.0, -30.0, 10);
spinnerVelX.setPrefWidth(65);
spinnerVelY.setPrefWidth(65);
spinnerVelX.valueProperty().addListener((observable, oldValue, newValue) -> {
emitter.setVelocityFunction((i, x, y) -> new Point2D(newValue, spinnerVelY.getValue()));
});
spinnerVelY.valueProperty().addListener((observable, oldValue, newValue) -> {
emitter.setVelocityFunction((i, x, y) -> new Point2D(spinnerVelX.getValue(), newValue));
});
Spinner<Double> spinnerAccelX = new Spinner<>(-150.0, 150.0, 0.0, 10);
Spinner<Double> spinnerAccelY = new Spinner<>(-150.0, 150.0, 0.0, 10);
spinnerAccelX.setPrefWidth(65);
spinnerAccelY.setPrefWidth(65);
spinnerAccelX.valueProperty().addListener((observable, oldValue, newValue) -> {
emitter.setAccelerationFunction(() -> new Point2D(newValue, spinnerAccelY.getValue()));
});
spinnerAccelY.valueProperty().addListener((observable, oldValue, newValue) -> {
emitter.setAccelerationFunction(() -> new Point2D(spinnerAccelX.getValue(), newValue));
});
ChoiceBox<BlendMode> choiceBlend = getUIFactory().newChoiceBox(FXCollections.observableArrayList(BlendMode.values()));
emitter.blendModeProperty().bind(choiceBlend.valueProperty());
choiceBlend.setValue(BlendMode.ADD);
ChoiceBox<EasingInterpolator> choiceInterpolator = getUIFactory().newChoiceBox(FXCollections.observableArrayList(Interpolators.values()));
choiceInterpolator.setValue(Interpolators.LINEAR);
choiceInterpolator.valueProperty().addListener((observable, oldValue, newValue) -> {
emitter.setInterpolator(newValue.EASE_OUT());
});
ColorPicker startColor = new ColorPicker((Color) emitter.getStartColor());
ColorPicker endColor = new ColorPicker((Color) emitter.getEndColor());
emitter.startColorProperty().bind(startColor.valueProperty());
emitter.endColorProperty().bind(endColor.valueProperty());
VBox vbox = new VBox(10);
vbox.setTranslateX(700);
vbox.getChildren().addAll(new HBox(10, new Text("Vel X and Y"), spinnerVelX, spinnerVelY), new HBox(10, new Text("Acc X and Y"), spinnerAccelX, spinnerAccelY), new Text("Number of Particles:"), spinnerNumParticles, new Text("Min Size:"), spinnerMinSize, new Text("Max Size:"), spinnerMaxSize, new Text("Emission Rate:"), spinnerRate, new Text("Start Color:"), startColor, new Text("End Color:"), endColor, choiceBlend, choiceInterpolator);
getGameScene().addUINode(vbox);
}
use of javafx.scene.control.ColorPicker in project Malai by arnobl.
the class TestScroll method testScrollingNoActionWhenNullRegistered.
@Test
void testScrollingNoActionWhenNullRegistered() throws CancelFSMException {
ColorPicker dummyWidget = new ColorPicker();
interaction.registerToNodes(null);
dummyWidget.fireEvent(createScrollEvent(1, 2, 5, 0));
Mockito.verify(handler, Mockito.never()).fsmStops();
Mockito.verify(handler, Mockito.never()).fsmStarts();
}
use of javafx.scene.control.ColorPicker in project Malai by arnobl.
the class TestScroll method testScrollingNoActionWhenContainsNullRegistered.
@Test
void testScrollingNoActionWhenContainsNullRegistered() throws CancelFSMException {
ColorPicker dummyWidget = new ColorPicker();
interaction.registerToNodes(Collections.singletonList(null));
dummyWidget.fireEvent(createScrollEvent(1, 2, 5, 0));
Mockito.verify(handler, Mockito.never()).fsmStops();
Mockito.verify(handler, Mockito.never()).fsmStarts();
}
use of javafx.scene.control.ColorPicker in project Malai by arnobl.
the class TestScroll method testNoActionWhenNotScrollingRegistered.
@Test
void testNoActionWhenNotScrollingRegistered() throws CancelFSMException {
ColorPicker dummyWidgetNotRegistered = new ColorPicker();
interaction.registerToNodes(Collections.singletonList(new CheckBox()));
dummyWidgetNotRegistered.fireEvent(createScrollEvent(1, 2, 5, 0));
Mockito.verify(handler, Mockito.never()).fsmStops();
Mockito.verify(handler, Mockito.never()).fsmStarts();
}
Aggregations