Java 类javafx.scene.Group 实例源码

项目:Java-for-Data-Science    文件:PieChart - MainApp.java   
@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Europian Country Population");
    stage.setWidth(500);
    stage.setHeight(500);

    ObservableList<PieChart.Data> pieChartData =
            FXCollections.observableArrayList(
            new PieChart.Data("Belgium", 3),
            new PieChart.Data("France", 26),
            new PieChart.Data("Germany", 35),
            new PieChart.Data("Netherlands", 7),
            new PieChart.Data("Sweden", 4),
            new PieChart.Data("United Kingdom", 25));
    final PieChart pieChart = new PieChart(pieChartData);
    pieChart.setTitle("Country Population");

    ((Group) scene.getRoot()).getChildren().add(pieChart);
    stage.setScene(scene);
    stage.show();
}
项目:marathonv5    文件:ChoiceBoxSample.java   
@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    scene.setFill(Color.ALICEBLUE);
    stage.setScene(scene);
    stage.show();

    stage.setTitle("ChoiceBox Sample");
    stage.setWidth(300);
    stage.setHeight(200);

    label.setFont(Font.font("Arial", 25));
    label.setLayoutX(40);

   final String[] greetings = new String[]{"Hello", "Hola", "Привет", "你好",
       "こんにちは"};
   final ChoiceBox cb = new ChoiceBox(FXCollections.observableArrayList(
       "English", "Español", "Русский", "简体中文", "日本語")
   );

   cb.getSelectionModel().selectedIndexProperty().addListener(
       (ObservableValue<? extends Number> ov,
            Number old_val, Number new_val) -> {
                label.setText(greetings[new_val.intValue()]);            
    });

    cb.setTooltip(new Tooltip("Select the language"));
    cb.setValue("English");
    HBox hb = new HBox();
    hb.getChildren().addAll(cb, label);
    hb.setSpacing(30);
    hb.setAlignment(Pos.CENTER);
    hb.setPadding(new Insets(10, 0, 0, 10));

    ((Group) scene.getRoot()).getChildren().add(hb);




}
项目:ChessBot    文件:UIUtils.java   
public static void alwaysInTop(Alert alert) {
        try{
            DialogPane root = alert.getDialogPane();

            Stage dialogStage = new Stage(StageStyle.UTILITY);

            for (ButtonType buttonType : root.getButtonTypes()) {
                ButtonBase button = (ButtonBase) root.lookupButton(buttonType);
                button.setOnAction(evt -> {
                    root.setUserData(buttonType);
                    dialogStage.close();
                });
            }

            root.getScene().setRoot(new Group());

            Scene scene = new Scene(root);

            dialogStage.setScene(scene);
            dialogStage.initModality(Modality.APPLICATION_MODAL);
            dialogStage.setAlwaysOnTop(true);
            dialogStage.setResizable(false);
            dialogStage.showAndWait();
        }catch(Exception e){

        }
//        Optional<ButtonType> result = Optional.ofNullable((ButtonType) root.getUserData());
    }
项目:CapsLock    文件:CharPanelGenerator.java   
/**
 * Generates a panel image form char.
 * <p>First, this function converts ch to upper case if ch is lower case.</p>
 * <p>Then, this generates javafx's image from ch.And return it.</p>
 * You can fix the resolution of image through {@link capslock.CharPanelGenerator#PANEL_IMAGE_SIZE}
 * and {@link capslock.CharPanelGenerator#FONT_SIZE}.
 * @param ch パネルの生成に使う1文字.
 * @param color 背景色.
 * @return 生成されたパネル.
 */
static final Image generate(char ch, Color color){
    final Label label = new Label(Character.toString(Character.toUpperCase(ch)));
    label.setMinSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    label.setMaxSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    label.setPrefSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    label.setFont(Font.font(FONT_SIZE));
    label.setAlignment(Pos.CENTER);
    label.setTextFill(Color.WHITE);
    label.setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
    final Scene scene = new Scene(new Group(label));
    final WritableImage img = new WritableImage(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    scene.snapshot(img);
    return img ;
}
项目:incubator-netbeans    文件:ChartLine.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    NumberAxis xAxis = new NumberAxis("Values for X-Axis", 0, 3, 1);
    NumberAxis yAxis = new NumberAxis("Values for Y-Axis", 0, 3, 1);
    ObservableList<XYChart.Series<Double,Double>> lineChartData = FXCollections.observableArrayList(
        new LineChart.Series<Double,Double>("Series 1", FXCollections.observableArrayList(
            new XYChart.Data<Double,Double>(0.0, 1.0),
            new XYChart.Data<Double,Double>(1.2, 1.4),
            new XYChart.Data<Double,Double>(2.2, 1.9),
            new XYChart.Data<Double,Double>(2.7, 2.3),
            new XYChart.Data<Double,Double>(2.9, 0.5)
        )),
        new LineChart.Series<Double,Double>("Series 2", FXCollections.observableArrayList(
            new XYChart.Data<Double,Double>(0.0, 1.6),
            new XYChart.Data<Double,Double>(0.8, 0.4),
            new XYChart.Data<Double,Double>(1.4, 2.9),
            new XYChart.Data<Double,Double>(2.1, 1.3),
            new XYChart.Data<Double,Double>(2.6, 0.9)
        ))
    );
    LineChart chart = new LineChart(xAxis, yAxis, lineChartData);
    root.getChildren().add(chart);
}
项目:TechnicalAnalysisTool    文件:TatMessageBox.java   
/**
    * Make a Error Dialog
    * @return BorderPane
    */
   public void makeErrorGUI() {
       root = new Group();
       Scene scene = new Scene(root, 360, 185, Color.WHITE);
       ImagePattern pattern = new ImagePattern(new Image("icon/bk2.jpg"));
       scene.setFill(pattern);
       setTitle("Error");
       setScene(scene);
       Image appIcon = new Image("icon/ERROR.png");
       getIcons().add(appIcon);
       BorderPane bp = new BorderPane();

       textArea = new TextArea(message);
       textArea.setEditable(false);
       textArea.setWrapText(true);
       textArea.setMaxWidth(320);
       textArea.setMaxHeight(130);
       HBox hBox = new HBox();
       hBox.setSpacing(5);
       hBox.setPadding(new Insets(5,0,0,0));
       hBox.setAlignment(Pos.BOTTOM_RIGHT);
       hBox.getChildren().addAll(openLogButton,okButton);
       bp.setCenter(textArea);
       bp.setBottom(hBox);
       root.getChildren().add(bp);
       sizeToScene();
       setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0);
setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0);
   }
项目:incubator-netbeans    文件:TransitionRotate.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 140,140));

    Rectangle rect = new Rectangle(20, 20, 100, 100);
    rect.setArcHeight(20);
    rect.setArcWidth(20);
    rect.setFill(Color.ORANGE);
    root.getChildren().add(rect);

    rotateTransition = RotateTransitionBuilder.create()
            .node(rect)
            .duration(Duration.seconds(4))
            .fromAngle(0)
            .toAngle(720)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:marathonv5    文件:StopWatchSample.java   
private void configureDigits() {
    for (int i : numbers) {
        digits[i] = new Text("0");
        digits[i].setFont(FONT);
        digits[i].setTextOrigin(VPos.TOP);
        digits[i].setLayoutX(2.3);
        digits[i].setLayoutY(-1);
        Rectangle background;
        if (i < 6) {
            background = createBackground(Color.web("#a39f91"), Color.web("#FFFFFF"));
            digits[i].setFill(Color.web("#000000"));
        } else {
            background = createBackground(Color.web("#bdbeb3"), Color.web("#FF0000"));
            digits[i].setFill(Color.web("#FFFFFF"));
        }
        digitsGroup[i] = new Group(background, digits[i]);
    }
}
项目:FxTreeMap    文件:FxMapItem.java   
public FxMapItem(FxMapModel model, MapData data) {
    mapModel = model;
    itemData = data;
    rect = new Rect();
    rectangle = new Rectangle();
    label = new Label(itemData.getName());
    tooltip = new Tooltip(itemData.getName());
    tooltip.setFont(new Font(DEFAULT_TOOLTIP_FONT_SIZE));
    mainNode = new Group(rectangle, label);
    Tooltip.install(label, tooltip);
    applyStyle(model.getStyle());
    if (data.hasChildrenData()) {
        rectangle.setEffect(new Glow());
    }
    propertyChangeSupport = new PropertyChangeSupport(FxMapItem.this);
    propertyChangeSupport.addPropertyChangeListener(model);
    initInteractivity();
}
项目:lttng-scope    文件:FadeTransitionEx.java   
@Override
public void start(Stage primaryStage) {
    if (primaryStage == null) {
        return;
    }

  Group group = new Group();
  Rectangle rect = new Rectangle(20,20,200,200);

  FadeTransition ft = new FadeTransition(Duration.millis(5000), rect);
  ft.setFromValue(1.0);
  ft.setToValue(0.0);
  ft.play();

  group.getChildren().add(rect);

  Scene scene = new Scene(group, 300, 200);
  primaryStage.setScene(scene);
  primaryStage.show();
}
项目:marathonv5    文件:VBoxSample.java   
public static Node createIconContent() {
    StackPane sp = new StackPane();
    VBox vbox = new VBox(3);
    vbox.setAlignment(Pos.CENTER);
    vbox.setPadding(new Insets(5, 5, 5, 5));

    Rectangle rectangle = new Rectangle(32, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    vbox.setPrefSize(rectangle.getWidth(), rectangle.getHeight());
    Rectangle r1 = new Rectangle(18, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(18, 14, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(18, 20, Color.web("#349b00"));

    vbox.getChildren().addAll(r1, r2, r3);
    sp.getChildren().addAll(rectangle, vbox);
    return new Group(sp);
}
项目:marathonv5    文件:ProgressSample.java   
@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250);
    stage.setScene(scene);
    stage.setTitle("Progress Controls");

    for (int i = 0; i < values.length; i++) {
        final Label label = labels[i] = new Label();
        label.setText("progress:" + values[i]);

        final ProgressBar pb = pbs[i] = new ProgressBar();
        pb.setProgress(values[i]);

        final ProgressIndicator pin = pins[i] = new ProgressIndicator();
        pin.setProgress(values[i]);
        final HBox hb = hbs[i] = new HBox();
        hb.setSpacing(5);
        hb.setAlignment(Pos.CENTER);
        hb.getChildren().addAll(label, pb, pin);
    }

    final VBox vb = new VBox();
    vb.setSpacing(5);
    vb.getChildren().addAll(hbs);
    scene.setRoot(vb);
    stage.show();
}
项目:lttng-scope    文件:UiModelApp2.java   
private static void drawBackground(Group parent, Pane parentPane) {
        DoubleStream.iterate(ENTRY_HEIGHT / 2, i -> i + ENTRY_HEIGHT).limit(10)
                .mapToObj(y -> {
                    Line line = new Line();
                    line.setStartX(0);
                    line.endXProperty().bind(parentPane.widthProperty());
//                    line.setEndX(MAX_WIDTH);
                    line.setStartY(y);
                    line.setEndY(y);

                    line.setStroke(BACKGROUD_LINES_COLOR);
                    line.setStrokeWidth(1.0);
                    return line;
                })
                .forEach(parent.getChildren()::add);
    }
项目:lttng-scope    文件:UiModelApp2.java   
private static void drawSelection(Group parent, Pane content) {
//        Rectangle selection1 = new Rectangle();
        Rectangle selection2 = new Rectangle();

        Stream.of(selection2).forEach(rect -> {
            rect.setMouseTransparent(true);

            rect.setStroke(SELECTION_STROKE_COLOR);
            rect.setStrokeWidth(SELECTION_STROKE_WIDTH);
            rect.setStrokeLineCap(StrokeLineCap.ROUND);
            rect.setFill(SELECTION_FILL_COLOR);

            rect.yProperty().bind(JfxUtils.ZERO_PROPERTY);
            rect.heightProperty().bind(content.heightProperty());
        });
//
//        selection1.setX(200);
//        selection1.setWidth(100);

        selection2.setX(500);
        selection2.setWidth(500);

        parent.getChildren().addAll(selection2);
    }
项目:lttng-scope    文件:UiModelApp.java   
private static void drawBackground(Group parent, Pane content) {
        DoubleStream.iterate(ENTRY_HEIGHT / 2, i -> i + ENTRY_HEIGHT).limit(10)
                .mapToObj(y -> {
                    Line line = new Line();
                    line.setStartX(0);
                    line.endXProperty().bind(content.widthProperty());
//                    line.setEndX(MAX_WIDTH);
                    line.setStartY(y);
                    line.setEndY(y);

                    line.setStroke(BACKGROUD_LINES_COLOR);
                    line.setStrokeWidth(1.0);
                    return line;
                })
                .forEach(parent.getChildren()::add);
    }
项目:lttng-scope    文件:TimeGraphDrawnEventLayer.java   
public TimeGraphDrawnEventLayer(TimeGraphWidget widget, Group parentGroup) {
    super(widget, parentGroup);

    ObservableSet<TimeGraphDrawnEventProvider> providers = TimeGraphDrawnEventProviderManager.instance().getRegisteredProviders();
    /* Populate with the initial values */
    providers.forEach(this::trackEventProvider);

    /* Add listeners to track registered/deregistered providers */
    providers.addListener((SetChangeListener<TimeGraphDrawnEventProvider>) change -> {
        if (change == null) {
            return;
        }
        TimeGraphDrawnEventProvider addedProvider = change.getElementAdded();
        if (addedProvider != null) {
            trackEventProvider(addedProvider);
        }

        TimeGraphDrawnEventProvider removedProvider = change.getElementRemoved();
        if (removedProvider != null) {
            untrackEventProvider(removedProvider);
        }
    });

    filterListener = new DrawnEventFilterListener(getWidget());
}
项目:JavaFX-EX    文件:DragSupportWindowTest.java   
@Override
public void start(Stage stage) {
  this.stage = stage;
  Scene scene = new Scene(new Group(new Rectangle(100, 100)), 300, 300);
  stage.setScene(scene);
  stage.setAlwaysOnTop(true);
  stage.setX(0);
  stage.setY(0);
  stage.show();
  config = DragSupport.bind(stage);
}
项目:marathonv5    文件:TilePaneSample.java   
public static Node createIconContent() {
    StackPane sp = new StackPane();
    TilePane iconTilePane = new TilePane();
    iconTilePane.setAlignment(Pos.CENTER);

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    iconTilePane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle[] rec = new Rectangle[9];
    for (int i = 0; i < rec.length; i++) {
        rec[i] = new Rectangle(14, 14, Color.web("#349b00"));
        TilePane.setMargin(rec[i], new Insets(2, 2, 2, 2));
    }
    iconTilePane.getChildren().addAll(rec);
    sp.getChildren().addAll(rectangle, iconTilePane);
    return new Group(sp);
}
项目:marathonv5    文件:CircleSample.java   
public CircleSample() {
    super(180,90);
    // Simple red filled circle
    Circle circle1 = new Circle(45,45,40, Color.RED);
    // Blue stroked circle
    Circle circle2 = new Circle(135,45,40);
    circle2.setStroke(Color.DODGERBLUE);
    circle2.setFill(null);
    // Create a group to show all the circles);
    getChildren().add(new Group(circle1,circle2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Circle 1 Fill", circle1.fillProperty()),
            new SimplePropertySheet.PropDesc("Circle 1 Radius", circle1.radiusProperty(), 10d, 40d),
            new SimplePropertySheet.PropDesc("Circle 2 Stroke", circle2.strokeProperty()),
            new SimplePropertySheet.PropDesc("Circle 2 Stroke Width", circle2.strokeWidthProperty(), 1d, 5d),
            new SimplePropertySheet.PropDesc("Circle 2 Radius", circle2.radiusProperty(), 10d, 40d)
    );
    // END REMOVE ME
}
项目:marathonv5    文件:AnchorPaneSample.java   
public static Node createIconContent() {
    StackPane sp = new StackPane();
    AnchorPane anchorPane = new AnchorPane();

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    anchorPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle r1 = new Rectangle(14, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(45, 10, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(35, 14, Color.web("#349b00"));

    anchorPane.getChildren().addAll(r1, r2, r3);
    AnchorPane.setTopAnchor(r1, Double.valueOf(1));
    AnchorPane.setLeftAnchor(r1, Double.valueOf(1));
    AnchorPane.setTopAnchor(r2, Double.valueOf(20));
    AnchorPane.setLeftAnchor(r2, Double.valueOf(1));
    AnchorPane.setBottomAnchor(r3, Double.valueOf(1));
    AnchorPane.setRightAnchor(r3, Double.valueOf(5));

    sp.getChildren().addAll(rectangle, anchorPane);
    return new Group(sp);
}
项目:marathonv5    文件:AnchorPaneSample.java   
public static Node createIconContent() {
    StackPane sp = new StackPane();
    AnchorPane anchorPane = new AnchorPane();

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    anchorPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle r1 = new Rectangle(14, 14, Color.web("#1c89f4"));
    Rectangle r2 = new Rectangle(45, 10, Color.web("#349b00"));
    Rectangle r3 = new Rectangle(35, 14, Color.web("#349b00"));

    anchorPane.getChildren().addAll(r1, r2, r3);
    AnchorPane.setTopAnchor(r1, Double.valueOf(1));
    AnchorPane.setLeftAnchor(r1, Double.valueOf(1));
    AnchorPane.setTopAnchor(r2, Double.valueOf(20));
    AnchorPane.setLeftAnchor(r2, Double.valueOf(1));
    AnchorPane.setBottomAnchor(r3, Double.valueOf(1));
    AnchorPane.setRightAnchor(r3, Double.valueOf(5));

    sp.getChildren().addAll(rectangle, anchorPane);
    return new Group(sp);
}
项目:marathonv5    文件:KeyEventsSample.java   
public static Node createIconContent() {
    javafx.scene.Group g = new javafx.scene.Group(
                createKey("A", 0d, 28d),
                createKey("S", 25d, 28d),
                createKey("D", 50d, 28d),
                createKey("W", 20d, 0d)
                );
    g.setLayoutX(30);
    g.setLayoutY(20);
    PerspectiveTransform pt = new PerspectiveTransform();
    pt.setLlx(0);
    pt.setLly(90);
    pt.setLrx(90);
    pt.setLry(90);
    pt.setUlx(15);
    pt.setUly(10);
    pt.setUrx(80);
    pt.setUry(5);
    g.setEffect(pt);
    return g;
}
项目:GazePlay    文件:SecondScreen.java   
public static SecondScreen launch() {

        ObservableList<Screen> screens = Screen.getScreens();

        if (screens.size() < 2)
            return null;

        Screen screen1 = screens.get(0);
        Screen screen2 = screens.get(1);
        log.info("screen1.getBounds() = " + screen1.getBounds());
        log.info("screen2.getBounds() = " + screen2.getBounds());
        Stage stage2 = new Stage();
        stage2.setScene(new Scene(new Label("primary")));
        stage2.setX(screen2.getVisualBounds().getMinX());
        stage2.setY(screen2.getVisualBounds().getMinY());
        stage2.setWidth(screen1.getBounds().getWidth());
        stage2.setHeight(screen1.getBounds().getHeight());
        Group root = new Group();
        Scene scene = new Scene(root, screen1.getBounds().getWidth(), screen1.getBounds().getHeight(), Color.BLACK);

        makeLighting(root, screen2.getBounds());

        stage2.setScene(scene);

        stage2.show();

        SecondScreen sc = new SecondScreen();

        Configuration config = ConfigurationBuilder.createFromPropertiesResource().build();

        /*
         * if (config.eyetracker.equals("tobii")) Tobii.execProg(sc); else
         */
        if (config.isGazeMode())
            gazeListener = new EyeTribeGazeListener(sc);
        else
            gazeListener = new FuzzyGazeListener(sc);

        return sc;
    }
项目:marathonv5    文件:HTMLEditorSample.java   
public static Node createIconContent() {

        Text htmlStart = new Text("<html>");
        Text htmlEnd = new Text("</html>");
        htmlStart.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlStart.setStyle("-fx-font-size: 20px;");
        htmlStart.setTextOrigin(VPos.TOP);
        htmlStart.setLayoutY(11);
        htmlStart.setLayoutX(20);

        htmlEnd.setFont(Font.font(null, FontWeight.BOLD, 20));
        htmlEnd.setStyle("-fx-font-size: 20px;");
        htmlEnd.setTextOrigin(VPos.TOP);
        htmlEnd.setLayoutY(31);
        htmlEnd.setLayoutX(20);

        return new Group(htmlStart, htmlEnd);
    }
项目:marathonv5    文件:ArcSample.java   
public ArcSample() {
    super(180,90);
    // Simple red filled arc
    Arc arc1 = new Arc(45,60,45,45,40,100);
    arc1.setFill(Color.RED);
    // Blue stroked arc
    Arc arc2 = new Arc(155,60,45,45,40,100);
    arc2.setStroke(Color.DODGERBLUE);
    arc2.setFill(null);
    // Create a group to show all the arcs);
    getChildren().add(new Group(arc1,arc2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Arc 1 Fill", arc1.fillProperty()),
            new SimplePropertySheet.PropDesc("Arc 1 Start Angle", arc1.startAngleProperty(), 0d, 360d),
            new SimplePropertySheet.PropDesc("Arc 1 Length", arc1.lengthProperty(), 0d, 360d),
            new SimplePropertySheet.PropDesc("Arc 2 Stroke", arc2.strokeProperty()),
            new SimplePropertySheet.PropDesc("Arc 2 Stroke Width", arc2.strokeWidthProperty(), 1d, 5d),
            new SimplePropertySheet.PropDesc("Arc 2 Radius X", arc2.radiusXProperty(), 0d, 50d),
            new SimplePropertySheet.PropDesc("Arc 2 Radius Y", arc2.radiusYProperty(), 0d, 50d)
    );
    // END REMOVE ME
}
项目:marathonv5    文件:ChangeListenerSample.java   
private static Group createBean(double rotate, double translateX, double translateY) {
    javafx.scene.shape.Ellipse bean1 = new javafx.scene.shape.Ellipse(16, 10);
    javafx.scene.shape.Ellipse bean1end = new javafx.scene.shape.Ellipse( 4,3, 3.2, 1.8);
    bean1end.setFill(Color.WHITESMOKE);
    bean1.setFill(Color.BROWN);
    javafx.scene.Group group = new javafx.scene.Group(bean1, bean1end);
    group.setRotate(rotate);
    group.setTranslateX(translateX+57);
    group.setTranslateY(translateY+57);
    DropShadow dropShadow = new DropShadow();
    dropShadow.setOffsetX(2);
    dropShadow.setOffsetY(3);
    group.setEffect(dropShadow);
    return group;
}
项目:incubator-netbeans    文件:Main.java   
@Override public void start(Stage stage) {
    Config.initialize();
    Group root = new Group();
    mainFrame = new MainFrame(root);
    stage.setTitle("Brick Breaker");
    stage.setResizable(false);
    stage.setWidth(Config.SCREEN_WIDTH + 2*Config.WINDOW_BORDER);
    stage.setHeight(Config.SCREEN_HEIGHT+ 2*Config.WINDOW_BORDER + Config.TITLE_BAR_HEIGHT);
    Scene scene = new Scene(root);
    scene.setFill(Color.BLACK);
    stage.setScene(scene);
    mainFrame.changeState(MainFrame.SPLASH);
    stage.show();
}
项目:marathonv5    文件:PathSample.java   
public PathSample() {
    super(180,90);
    // Create path shape - square
    Path path1 = new Path();
    path1.getElements().addAll(
            new MoveTo(25, 25),
            new HLineTo(65),
            new VLineTo(65),
            new LineTo(25, 65),
            new ClosePath()         
            );
    path1.setFill(null);
    path1.setStroke(Color.RED);
    path1.setStrokeWidth(2);

    // Create path shape - curves
    Path path2 = new Path();
    path2.getElements().addAll(
            new MoveTo(100, 45),
            new CubicCurveTo(120, 20, 130, 80, 140, 45),
            new QuadCurveTo(150, 0, 160, 45),
            new ArcTo(20, 40, 0, 180, 45, true, true)
            );
    path2.setFill(null);
    path2.setStroke(Color.DODGERBLUE);
    path2.setStrokeWidth(2);

    // show the path shapes;
    getChildren().add(new Group(path1, path2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Path 1 Stroke", path1.strokeProperty()),
            new SimplePropertySheet.PropDesc("Path 2 Stroke", path2.strokeProperty())
    );
    // END REMOVE ME
}
项目:chess-master    文件:View.java   
/**
 * Initialized the main menu of the app.
 *
 * @since 1.0
 * @version 1.0
 */
private void initMainMenu() {
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

    // Initialize root element and scene.
    Group root = new Group();
    Scene scene = new Scene(root, screenSize.getWidth() - 10, screenSize.getHeight() - 10);

    // Build menu
    this.buildMainMenu(root, scene, screenSize);

    this.primaryStage.setMaximized(true);
    this.primaryStage.setScene(scene);
    this.primaryStage.sizeToScene();
}
项目:JavaFx-Material-Design    文件:Playground.java   
@Override
public void start(Stage primaryStage) throws Exception {
    Group root = new Group();
    Line seeSaw = new Line (60,340,340,140);
    seeSaw.setStroke(Color.BLACK);
    seeSaw.setStrokeWidth(15);
    Circle circle = new Circle(70,280,40);
    circle.setStroke(Color.GREENYELLOW);
    circle.setFill(Color.ORANGE);
    circle.setStrokeWidth(5);

    Rectangle rect = new Rectangle(240,90,80,70);
    rect.setStroke(Color.MEDIUMPURPLE);
    rect.setStrokeWidth(5);
    rect.setFill(Color.MEDIUMPURPLE);

    Line left = new Line (200,240,160,340);
    left.setStrokeWidth(5);
    Line right = new Line(200,240,240,340);
    right.setStrokeWidth(5);

    root.getChildren().addAll(seeSaw,rect,circle,left,right);



    Scene scene = new Scene(root, 400, 400,Color.WHITE);
    primaryStage.setTitle("SeeSaw");
    primaryStage.setScene(scene);
    primaryStage.show();



}
项目:incubator-netbeans    文件:Cube3D.java   
public Node create3dContent() {
    Cube c = new Cube(50,Color.RED,1);
    c.rx.setAngle(45);
    c.ry.setAngle(45);
    Cube c2 = new Cube(50,Color.GREEN,1);
    c2.setTranslateX(100);
    c2.rx.setAngle(45);
    c2.ry.setAngle(45);
    Cube c3 = new Cube(50,Color.ORANGE,1);
    c3.setTranslateX(-100);
    c3.rx.setAngle(45);
    c3.ry.setAngle(45);

    animation = new Timeline();
    animation.getKeyFrames().addAll(
            new KeyFrame(Duration.ZERO,
                    new KeyValue(c.ry.angleProperty(), 0d),
                    new KeyValue(c2.rx.angleProperty(), 0d),
                    new KeyValue(c3.rz.angleProperty(), 0d)
            ),
            new KeyFrame(Duration.seconds(1),
                    new KeyValue(c.ry.angleProperty(), 360d),
                    new KeyValue(c2.rx.angleProperty(), 360d),
                    new KeyValue(c3.rz.angleProperty(), 360d)
            ));
    animation.setCycleCount(Animation.INDEFINITE);

    return new Group(c,c2,c3);
}
项目:incubator-netbeans    文件:StopWatch.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root, 310, 320));
    watch = new Watch();
    myLayout();
    root.getChildren().add(watch);
}
项目:incubator-netbeans    文件:StopWatch.java   
private Group createNumbers() {
    return new Group(
            createNumber("30", -9.5, radius - 16 + 4.5),
            createNumber("0", -4.7, -radius + 22),
            createNumber("45", -radius + 10, 5),
            createNumber("15", radius - 30, 5));
}
项目:incubator-netbeans    文件:KeyStrokeMotion.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 480,480));
    lettersPane = new LettersPane();
    root.getChildren().add(lettersPane);
}
项目:marathonv5    文件:DigitalClock.java   
public Clock(Color onColor, Color offColor) {
    // create effect for on LEDs
    Glow onEffect = new Glow(1.7f);
    onEffect.setInput(new InnerShadow());
    // create effect for on dot LEDs
    Glow onDotEffect = new Glow(1.7f);
    onDotEffect.setInput(new InnerShadow(5,Color.BLACK));
    // create effect for off LEDs
    InnerShadow offEffect = new InnerShadow();
    // create digits
    digits = new Digit[7];
    for (int i = 0; i < 6; i++) {
        Digit digit = new Digit(onColor, offColor, onEffect, offEffect);
        digit.setLayoutX(i * 80 + ((i + 1) % 2) * 20);
        digits[i] = digit;
        getChildren().add(digit);
    }
    // create dots
    Group dots = new Group(
            new Circle(80 + 54 + 20, 44, 6, onColor),
            new Circle(80 + 54 + 17, 64, 6, onColor),
            new Circle((80 * 3) + 54 + 20, 44, 6, onColor),
            new Circle((80 * 3) + 54 + 17, 64, 6, onColor));
    dots.setEffect(onDotEffect);
    getChildren().add(dots);
    // update digits to current time and start timer to update every second
    refreshClocks();
}
项目:incubator-netbeans    文件:PaginationDemo.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    VBox outerBox = new VBox();
    outerBox.setAlignment(Pos.CENTER);
    //Images for our pages
    for (int i = 0; i < 7; i++) {
        images[i] = new Image(PaginationDemo.class.getResource("animal" + (i + 1) + ".jpg").toExternalForm(), false);
    }

    pagination = PaginationBuilder.create().pageCount(7).pageFactory(new Callback<Integer, Node>() {           
        @Override public Node call(Integer pageIndex) {
            return createAnimalPage(pageIndex);
        }
    }).build();
    //Style can be numeric page indicators or bullet indicators
    Button styleButton = ButtonBuilder.create().text("Toggle pagination style").onAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent me) {
            if (!pagination.getStyleClass().contains(Pagination.STYLE_CLASS_BULLET)) {
                pagination.getStyleClass().add(Pagination.STYLE_CLASS_BULLET);
            } else {
                pagination.getStyleClass().remove(Pagination.STYLE_CLASS_BULLET);
            }
        }
    }).build();

    outerBox.getChildren().addAll(pagination, styleButton);
    root.getChildren().add(outerBox);
}
项目:jmonkeybuilder    文件:EditorFXScene.java   
public EditorFXScene(@NotNull final Group root) {
    super(root);

    this.canvas = new EditorFXImageView();
    this.canvas.setMouseTransparent(true);
    this.canvas.getProperties()
            .put(JFXMouseInput.PROP_USE_LOCAL_COORDS, true);

    this.loadingCount = new AtomicInteger();
    this.components = ArrayFactory.newArraySet(ScreenComponent.class);
    this.container = new StackPane();
    this.container.setId(CSSIds.ROOT_CONTAINER);
    this.container.setPickOnBounds(false);
    this.hideLayer = new StackPane();
    this.hideLayer.setVisible(false);
    this.loadingLayer = new VBox();
    this.loadingLayer.setId(CSSIds.EDITOR_LOADING_LAYER);
    this.loadingLayer.setVisible(false);

    final Pane background = new Pane();
    background.setId(CSSIds.ROOT);

    FXUtils.addDebugBorderTo(canvas);

    root.getChildren().addAll(hideLayer, background, container, loadingLayer);

    FXUtils.bindFixedWidth(background, widthProperty());
    FXUtils.bindFixedHeight(background, heightProperty());
    FXUtils.bindFixedWidth(container, widthProperty());
    FXUtils.bindFixedHeight(container, heightProperty());
    FXUtils.bindFixedWidth(loadingLayer, widthProperty());
    FXUtils.bindFixedHeight(loadingLayer, heightProperty());
    FXUtils.setFixedSize(hideLayer, 300, 300);

    hideCanvas();
}
项目:incubator-netbeans    文件:TransitionPath.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 400,260));
    Rectangle rect = new Rectangle (0, 0, 40, 40);
    rect.setArcHeight(10);
    rect.setArcWidth(10);
    rect.setFill(Color.ORANGE);
    root.getChildren().add(rect);
    Path path = PathBuilder.create()
            .elements(
                new MoveTo(20,20),
                new CubicCurveTo(380, 0, 380, 120, 200, 120),
                new CubicCurveTo(0, 120, 0, 240, 380, 240)
            )
            .build();
    path.setStroke(Color.DODGERBLUE);
    path.getStrokeDashArray().setAll(5d,5d);
    root.getChildren().add(path);

    pathTransition = PathTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .path(path)
            .node(rect)
            .orientation(OrientationType.ORTHOGONAL_TO_TANGENT)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
项目:incubator-netbeans    文件:Xylophone.java   
public static Group createRectangle(Color color, double tx, double ty, double sx, double sy) {
    Group squareGroup = new Group();
    Rectangle squareShape = new Rectangle(1.0, 1.0);
    squareShape.setFill(color);
    squareShape.setTranslateX(-0.5);
    squareShape.setTranslateY(-0.5);
    squareGroup.getChildren().add(squareShape);
    squareGroup.setTranslateX(tx);
    squareGroup.setTranslateY(ty);
    squareGroup.setScaleX(sx);
    squareGroup.setScaleY(sy);
    return squareGroup;
}
项目:marathonv5    文件:UnitedStatesMapPane.java   
private void setGroupColor(Group group, Color color) {
    if (group != null) {
        for(Node child: group.getChildren()) {
            if (child instanceof Shape) {
                ((Shape)child).setFill(color);
            } else if (child instanceof Group) {
                setGroupColor((Group)child,color);
            }
        }
    }
}