use of javafx.scene.Group in project org.csstudio.display.builder by kasemir.
the class PointsEditorDemo method start.
@Override
public void start(final Stage stage) throws Exception {
poly.setStroke(Color.BLUE);
poly.setStrokeWidth(4);
poly.setStrokeLineCap(StrokeLineCap.ROUND);
poly.setStrokeLineJoin(StrokeLineJoin.ROUND);
poly.setFill(Color.CORNSILK);
final Group root = new Group();
root.getChildren().add(poly);
final Scene scene = new Scene(root, 400, 400);
stage.setScene(scene);
stage.show();
EditorUtil.setSceneStyle(scene);
editor = new PointsEditor(root, points, new PointsEditorListener() {
@Override
public void pointsChanged(final Points points) {
updatePoly();
}
@Override
public void done() {
editor.dispose();
}
});
updatePoly();
}
use of javafx.scene.Group in project org.csstudio.display.builder by kasemir.
the class GroupVsPaneDemo method start.
@Override
public void start(Stage primaryStage) {
Pane pane = new Pane();
Group group = new Group();
VBox.setVgrow(group, Priority.NEVER);
VBox.setVgrow(pane, Priority.NEVER);
VBox vbox = new VBox(group, pane);
Rectangle rect1 = new Rectangle(100, 100, 100, 100);
Rectangle rect2 = new Rectangle(100, 100, 100, 100);
Rectangle rect3 = new Rectangle(200, 200, 100, 100);
Rectangle rect4 = new Rectangle(200, 200, 100, 100);
rect1.setFill(Color.BLUE);
rect2.setFill(Color.BLUE);
rect3.setFill(Color.GREEN);
rect4.setFill(Color.GREEN);
group.getChildren().addAll(rect1, rect3);
pane.getChildren().addAll(rect2, rect4);
Scene scene = new Scene(vbox, 800, 800);
scene.addEventHandler(KeyEvent.KEY_PRESSED, e -> {
double deltaX;
switch(e.getCode()) {
case LEFT:
deltaX = -10;
break;
case RIGHT:
deltaX = 10;
break;
default:
deltaX = 0;
}
rect3.setX(rect3.getX() + deltaX);
rect4.setX(rect4.getX() + deltaX);
});
primaryStage.setScene(scene);
primaryStage.show();
}
use of javafx.scene.Group in project FinalCrypt by ron-from-nl.
the class GUIFX method introAlert.
public Alert introAlert(AlertType type, String title, String headerText, String message, String optOutMessage, Consumer<Boolean> optOutAction, ButtonType... buttonTypes) {
Alert alert = new Alert(type);
alert.getDialogPane().applyCss();
Node graphic = alert.getDialogPane().getGraphic();
DialogPane dialogPane = new DialogPane() {
@Override
protected Node createDetailsButton() {
CheckBox checkbox = new CheckBox();
checkbox.setText(optOutMessage);
checkbox.setOnAction(e -> optOutAction.accept(checkbox.isSelected()));
return checkbox;
}
};
dialogPane.getStylesheets().add(getClass().getResource("myInfoAlerts.css").toExternalForm());
dialogPane.getStyleClass().add("myDialog");
alert.setDialogPane(dialogPane);
alert.getDialogPane().getButtonTypes().addAll(buttonTypes);
alert.getDialogPane().setContentText(message);
alert.getDialogPane().setExpandableContent(new Group());
alert.getDialogPane().setExpanded(true);
alert.getDialogPane().setGraphic(graphic);
alert.setTitle(title);
alert.setHeaderText(headerText);
return alert;
}
use of javafx.scene.Group in project contentment by GeePawHill.
the class JfxUtilityTest method before.
@Before
public void before() {
calls = new ArrayList<>();
root = new Group();
parentWithChildren = new Group();
parentWithoutChildren = new Group();
leafOffRoot = new Text();
root.getChildren().addAll(parentWithChildren, parentWithoutChildren, leafOffRoot);
leaf2 = new Text();
leaf3 = new Text();
parentWithChildren.getChildren().addAll(leaf2, leaf3);
}
use of javafx.scene.Group in project contentment by GeePawHill.
the class AnimationTimerExperiment method start.
@Override
public void start(final Stage primaryStage) {
for (int i = 0; i < STAR_COUNT; i++) {
nodes[i] = new Rectangle(1, 1, Color.WHITE);
angles[i] = 2.0 * Math.PI * random.nextDouble();
start[i] = random.nextInt(2000000000);
}
final Scene scene = new Scene(new Group(nodes), 800, 600, Color.BLACK);
primaryStage.setScene(scene);
primaryStage.show();
new AnimationTimer() {
@Override
public void handle(long now) {
final double width = 0.5 * primaryStage.getWidth();
final double height = 0.5 * primaryStage.getHeight();
final double radius = Math.sqrt(2) * Math.max(width, height);
for (int i = 0; i < STAR_COUNT; i++) {
final Node node = nodes[i];
final double angle = angles[i];
final long t = (now - start[i]) % 2000000000;
final double d = t * radius / 2000000000.0;
node.setTranslateX(Math.cos(angle) * d + width);
node.setTranslateY(Math.sin(angle) * d + height);
}
}
}.start();
}
Aggregations