Java Code Examples for javafx.scene.Group

The following examples show how to use javafx.scene.Group. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: phoebus   Source File: PointsEditor.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/** Create points editor
 *  @param root Parent group where editor can host its UI elements
 *  @param constrain Point constrain
 *  @param points Points to edit
 *  @param listener Listener to notify
 */
public PointsEditor(final Group root, final PointConstraint constrain, final Points points, final PointsEditorListener listener)
{
    init();

    this.constrain = constrain;
    this.points = points;
    this.listener = listener;
    handle_group = new Group();
    root.getChildren().add(handle_group);

    line.getStyleClass().add("points_edit_line");

    startMode(points.size() <= 0
              ? Mode.APPEND // No points, first append some
              : Mode.EDIT); // Start by editing existing points

    handle_group.getScene().addEventFilter(KeyEvent.KEY_PRESSED, key_filter);
}
 
Example 2
Source Project: cssfx   Source File: CSSFXTesterApp.java    License: Apache License 2.0 6 votes vote down vote up
private Group buildCirclePane(int prefWidth, int prefHeight) {
    Group freePlacePane = new Group();
    int defaultShapeSize = 50;
    int shapeNumber = 10;
    Random r = new Random();

    for (int i = 0; i < shapeNumber; i++) {
        Circle c = new Circle(Math.max(10, defaultShapeSize * r.nextInt(100) / 100));
        c.getStyleClass().add("circle");
        if (i % 2 == 0) {
            c.getStyleClass().add("even");
        } else {
            c.getStyleClass().add("odd");
        }
        c.setCenterX(r.nextInt(prefWidth));
        c.setCenterY(r.nextInt(prefHeight));
        c.setFill(Color.BLUE);
        freePlacePane.getChildren().add(c);
    }

    freePlacePane.getStyleClass().add("circles");
    freePlacePane.prefWidth(250);
    freePlacePane.prefWidth(200);
    return freePlacePane;
}
 
Example 3
Source Project: marathonv5   Source File: AnchorPaneSample.java    License: Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 4
Source Project: netbeans   Source File: TimelineInterpolator.java    License: Apache License 2.0 6 votes vote down vote up
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 250, 90));

    //create circles by method createMovingCircle listed below
    Circle circle1 = createMovingCircle(Interpolator.LINEAR); //default interpolator
    circle1.setOpacity(0.7);
    Circle circle2 = createMovingCircle(Interpolator.EASE_BOTH); //circle slows down when reached both ends of trajectory
    circle2.setOpacity(0.45);
    Circle circle3 = createMovingCircle(Interpolator.EASE_IN);
    Circle circle4 = createMovingCircle(Interpolator.EASE_OUT);
    Circle circle5 = createMovingCircle(Interpolator.SPLINE(0.5, 0.1, 0.1, 0.5)); //one can define own behaviour of interpolator by spline method
    
    root.getChildren().addAll(
            circle1,
            circle2,
            circle3,
            circle4,
            circle5
    );
}
 
Example 5
Source Project: OSPREY3   Source File: KStarTreeNode.java    License: GNU General Public License v2.0 6 votes vote down vote up
public KStarTreeNode(int level, String[] assignments, int[] confAssignments, BigDecimal lowerBound, BigDecimal upperBound,
                     double confLowerBound, double confUpperBound, double epsilon) {
    this.level = level;
    this.assignments = assignments;
    this.confAssignments = confAssignments;
    this.upperBound = upperBound;
    this.lowerBound = lowerBound;
    this.epsilon = new BigDecimal(epsilon);
    this.bandGroup = new Group();
    this.confLowerBound = confLowerBound;
    this.confUpperBound = confUpperBound;
    this.colorSeeds = new Random[assignments.length];
    if(isRoot()) {
        this.overallUpperBound = upperBound;
    }
}
 
Example 6
Source Project: narjillos   Source File: EnvironmentView.java    License: MIT License 6 votes vote down vote up
public Node toNode() {
	if (viewState.getLight() == Light.OFF)
		return darkness;

	boolean isInfrared = viewState.getLight() == Light.INFRARED;
	boolean effectsOn = viewState.getEffects() == Effects.ON;

	Group result = new Group();

	Node backgroundFill = isInfrared ? infraredEmptySpace : emptySpace;
	darkenWithDistance(backgroundFill, viewport.getZoomLevel());
	result.getChildren().add(backgroundFill);

	Node speckles = specklesView.toNode(isInfrared);
	if (speckles != null) {
		darkenWithDistance(speckles, viewport.getZoomLevel());
		result.getChildren().add(speckles);
	}

	result.getChildren().add(getThingsGroup(isInfrared, effectsOn));

	if (effectsOn)
		setZoomLevelEffects(result);

	return result;
}
 
Example 7
Source Project: netbeans   Source File: StopWatch.java    License: Apache License 2.0 6 votes vote down vote up
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]);
    }
}
 
Example 8
Source Project: marathonv5   Source File: ACEEditorSample.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void start(Stage stage) throws IOException {
    INITIAL_TEXT = new String(IOUtils.toByteArray(ACEEditorSample.class.getResourceAsStream("/aceeditor.js")));
    stage.setTitle("HTMLEditor Sample");
    stage.setWidth(650);
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();
    root.setPadding(new Insets(8, 8, 8, 8));
    root.setSpacing(5);
    root.setAlignment(Pos.BOTTOM_LEFT);

    final ACEEditor htmlEditor = new ACEEditor(true, 1, true);
    htmlEditor.setText(INITIAL_TEXT);
    htmlEditor.setMode("javascript");

    root.getChildren().addAll(htmlEditor.getNode());
    scene.setRoot(root);

    stage.setScene(scene);
    stage.show();
}
 
Example 9
Source Project: marathonv5   Source File: CircleSample.java    License: Apache License 2.0 6 votes vote down vote up
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
}
 
Example 10
Source Project: Recaf   Source File: UiUtil.java    License: MIT License 6 votes vote down vote up
/**
 * @param access
 * 		Field modifiers.
 *
 * @return Graphic representing fields's attributes.
 */
public static Node createFieldGraphic(int access) {
	Group g = new Group();
	// Root icon
	String base = null;
	if(AccessFlag.isPublic(access))
		base = "icons/modifier/field_public.png";
	else if(AccessFlag.isProtected(access))
		base = "icons/modifier/field_protected.png";
	else if(AccessFlag.isPrivate(access))
		base = "icons/modifier/field_private.png";
	else
		base = "icons/modifier/field_default.png";
	g.getChildren().add(new IconView(base));
	// Add modifiers
	if(AccessFlag.isStatic(access))
		g.getChildren().add(new IconView("icons/modifier/static.png"));
	if(AccessFlag.isFinal(access))
		g.getChildren().add(new IconView("icons/modifier/final.png"));
	if(AccessFlag.isBridge(access) || AccessFlag.isSynthetic(access))
		g.getChildren().add(new IconView("icons/modifier/synthetic.png"));
	return g;
}
 
Example 11
Source Project: netbeans   Source File: ComponentsTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test(timeOut = 9000)
public void loadFX() throws Exception {
    final CountDownLatch cdl = new CountDownLatch(1);
    final CountDownLatch done = new CountDownLatch(1);
    final JFXPanel p = new JFXPanel();
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            Node wv = TestPages.getFX(10, cdl);
            Scene s = new Scene(new Group(wv));
            p.setScene(s);
            done.countDown();
        }
    });
    done.await();
    JFrame f = new JFrame();
    f.getContentPane().add(p);
    f.pack();
    f.setVisible(true);
    cdl.await();
}
 
Example 12
Source Project: marathonv5   Source File: HTMLEditorSample.java    License: Apache License 2.0 6 votes vote down vote up
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);
    }
 
Example 13
Source Project: phoebus   Source File: ImageScaling.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void start(final Stage stage)
{
    // Image with red border
    final WritableImage image = new WritableImage(WIDTH, HEIGHT);
    final PixelWriter writer = image.getPixelWriter();
    for (int x=0; x<WIDTH; ++x)
    {
        writer.setColor(x, 0, Color.RED);
        writer.setColor(x, HEIGHT-1, Color.RED);
    }
    for (int y=0; y<HEIGHT; ++y)
    {
        writer.setColor(0, y, Color.RED);
        writer.setColor(WIDTH-1, y, Color.RED);
    }

    // Draw into canvas, scaling 'up'
    final Canvas canvas = new Canvas(800, 600);
    canvas.getGraphicsContext2D().drawImage(image, 0, 0, canvas.getWidth(), canvas.getHeight());

    final Scene scene = new Scene(new Group(canvas), canvas.getWidth(), canvas.getHeight());
    stage.setScene(scene);
    stage.show();
}
 
Example 14
Source Project: gef   Source File: DotNodeLabelPart.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * The implementation of this class is mainly taken from the
 * org.eclipse.gef.zest.fx.parts.NodeLabelPart java class.
 *
 * Modification added: applying the external label css style on the Text
 * widget instead of its parent Group.
 */
@Override
protected void doRefreshVisual(Group visual) {
	Node node = getContent().getKey();
	Map<String, Object> attrs = node.attributesProperty();

	if (attrs.containsKey(ZestProperties.EXTERNAL_LABEL_CSS_STYLE__NE)) {
		String textCssStyle = ZestProperties.getExternalLabelCssStyle(node);
		getText().setStyle(textCssStyle);
	}

	String label = ZestProperties.getExternalLabel(node);
	if (label != null) {
		getText().setText(label);
	}

	IVisualPart<? extends javafx.scene.Node> firstAnchorage = getFirstAnchorage();
	if (firstAnchorage == null) {
		return;
	}

	refreshPosition(getVisual(), getLabelPosition());
}
 
Example 15
Source Project: ShootOFF   Source File: TargetView.java    License: GNU General Public License v3.0 6 votes vote down vote up
public TargetView(Group target, Map<String, String> targetTags, List<Target> targets) {
	targetFile = null;
	targetGroup = target;
	this.targetTags = targetTags;
	config = Optional.empty();
	parent = Optional.empty();
	this.targets = Optional.of(targets);
	userDeletable = false;
	cameraName = null;
	origWidth = targetGroup.getBoundsInParent().getWidth();
	origHeight = targetGroup.getBoundsInParent().getHeight();

	mousePressed();
	mouseDragged();
	mouseMoved();
	mouseReleased();
	keyPressed();

}
 
Example 16
Source Project: quantumjava   Source File: Main.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("Mary Had a Little Qubit");
    strangeBridge = new StrangeBridge();

    barn = new MapObject.Barn(new Location(2, 3), strangeBridge);
    rainbow = new MapObject.Rainbow(new Location(5, 0), strangeBridge);
    chickenCoop = new MapObject.ChickenCoop(new Location(5, 4), strangeBridge);
    nest = new MapObject.Nest(new Location(3, 4), strangeBridge);
    Group root = new Group();
    Scene scene = new Scene(root, BOARD_WIDTH, BOARD_HEIGHT, Color.WHITE);
    primaryStage.setScene(scene);
    populateBackground(root);
    scene.getStylesheets().add(Main.class.getResource("/styles.css").toExternalForm());

    root.getChildren().add(barn);
    root.getChildren().add(rainbow);
    root.getChildren().add(new MapObject.Church(new Location(6, 2), strangeBridge));
    root.getChildren().add(chickenCoop);
    root.getChildren().add(nest);
    MapObject.Fox fox = new MapObject.Fox(new Location(7, 4), strangeBridge);
    fox.setDirection(Direction.LEFT);
    fox.setScaleX(.5);
    fox.setScaleY(.5);
    root.getChildren().add(fox);
    helpTextProperty.set("Use the arrows to navigate Mary");
    mary = new SpriteView.Mary(new Location(0, 3), this);
    populateCells(root, mary);
    strangeBridge.setOpacity(0.5);
    root.getChildren().add(strangeBridge);
    root.getChildren().add(createHelpNode());

    root.getChildren().add(mary);
    addKeyHandler(scene, mary);

    primaryStage.show();
}
 
Example 17
Source Project: quantumjava   Source File: Main.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void populateBackground(Group root) {
    // Image by Victor Szalvay: http://www.flickr.com/photos/[email protected]/172603855
    ImageView background = new ImageView(getClass().getResource("images/field.jpg").toString());
    background.setFitHeight(BOARD_HEIGHT);
    root.getChildren().add(background);

}
 
Example 18
Source Project: games_oop_javafx   Source File: Chess.java    License: Apache License 2.0 5 votes vote down vote up
private Group buildGrid() {
    Group panel = new Group();
    for (int y = 0; y != this.size; y++) {
        for (int x = 0; x != this.size; x++) {
            panel.getChildren().add(
                    this.buildRectangle(x, y, 40, (x + y) % 2 == 0)
            );
        }
    }
    return panel;
}
 
Example 19
Source Project: netbeans   Source File: CubeSystem3D.java    License: Apache License 2.0 5 votes vote down vote up
private void init(Stage primaryStage) {
    Group root = new Group();
    root.setDepthTest(DepthTest.ENABLE);
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 500, 500, true));
    primaryStage.getScene().setCamera(new PerspectiveCamera());
    root.getTransforms().addAll(
        new Translate(500 / 2, 500 / 2),
        new Rotate(180, Rotate.X_AXIS)
    );
    root.getChildren().add(create3dContent());
}
 
Example 20
Source Project: G-Earth   Source File: ConfirmationDialog.java    License: MIT License 5 votes vote down vote up
public static Alert createAlertWithOptOut(Alert.AlertType type, String dialogKey, String title, String headerText,
                                          String message, String optOutMessage, /*Callback<Boolean, Void> optOutAction,*/
                                          ButtonType... buttonTypes) {
    Alert alert = new Alert(type);
    // Need to force the alert to layout in order to grab the graphic,
    // as we are replacing the dialog pane with a custom pane
    alert.getDialogPane().applyCss();
    Node graphic = alert.getDialogPane().getGraphic();
    // Create a new dialog pane that has a checkbox instead of the hide/show details button
    // Use the supplied callback for the action of the checkbox
    alert.setDialogPane(new DialogPane() {
        @Override
        protected Node createDetailsButton() {
            CheckBox optOut = new CheckBox();
            optOut.setText(optOutMessage);
            optOut.setOnAction(event -> {
                if (optOut.isSelected()) {
                    ignoreDialogs.add(dialogKey);
                }
            });
            return optOut;
        }
    });
    alert.getDialogPane().getButtonTypes().addAll(buttonTypes);
    alert.getDialogPane().setContentText(message);
    // Fool the dialog into thinking there is some expandable content
    // a Group won't take up any space if it has no children
    alert.getDialogPane().setExpandableContent(new Group());
    alert.getDialogPane().setExpanded(true);
    // Reset the dialog graphic using the default style
    alert.getDialogPane().setGraphic(graphic);
    alert.setTitle(title);
    alert.setHeaderText(headerText);
    return alert;
}
 
Example 21
Source Project: games_oop_javafx   Source File: TicTacToe.java    License: Apache License 2.0 5 votes vote down vote up
private Group buildMarkX(double x, double y, int size) {
    Group group = new Group();
    group.getChildren().addAll(
            new Line(
                    x + 10, y  + 10,
                    x + size - 10, y + size - 10
            ),
            new Line(
                    x + size - 10, y + 10,
                    x + 10, y + size - 10
            )
    );
    return group;
}
 
Example 22
Source Project: marathonv5   Source File: CurveFittedAreaChartSample.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
protected void layoutPlotChildren() {
    super.layoutPlotChildren();
    for (int seriesIndex = 0; seriesIndex < getDataSize(); seriesIndex++) {
        final XYChart.Series<Number, Number> series = getData().get(seriesIndex);
        final Path seriesLine = (Path) ((Group) series.getNode()).getChildren().get(1);
        final Path fillPath = (Path) ((Group) series.getNode()).getChildren().get(0);
        smooth(seriesLine.getElements(), fillPath.getElements());
    }
}
 
Example 23
Source Project: mars-sim   Source File: StarfieldFX.java    License: GNU General Public License v3.0 5 votes vote down vote up
public Group createStars(int w, int h) {
	
	generate();  	
	Group group = new Group(nodes);    	
	//group.prefHeight(w);
	//group.prefWidth(h);
	plotStars(w,h);
 	
 	return group;
}
 
Example 24
Source Project: chart-fx   Source File: DataViewerSample.java    License: Apache License 2.0 5 votes vote down vote up
private static Pane getDemoPane() {
    final Rectangle rect = new Rectangle(-130, -40, 80, 80);
    rect.setFill(Color.BLUE);
    final Circle circle = new Circle(0, 0, 40);
    circle.setFill(Color.GREEN);
    final Polygon triangle = new Polygon(60, -40, 120, 0, 50, 40);
    triangle.setFill(Color.RED);

    final Group group = new Group(rect, circle, triangle);
    group.setTranslateX(300);
    group.setTranslateY(200);

    final RotateTransition rotateTransition = new RotateTransition(Duration.millis(4000), group);
    rotateTransition.setByAngle(3.0 * 360);
    rotateTransition.setCycleCount(Animation.INDEFINITE);
    rotateTransition.setAutoReverse(true);
    rotateTransition.play();

    final RotateTransition rotateTransition1 = new RotateTransition(Duration.millis(1000), rect);
    rotateTransition1.setByAngle(360);
    rotateTransition1.setCycleCount(Animation.INDEFINITE);
    rotateTransition1.setAutoReverse(false);
    rotateTransition1.play();

    final RotateTransition rotateTransition2 = new RotateTransition(Duration.millis(1000), triangle);
    rotateTransition2.setByAngle(360);
    rotateTransition2.setCycleCount(Animation.INDEFINITE);
    rotateTransition2.setAutoReverse(false);
    rotateTransition2.play();
    group.setManaged(true);

    HBox.setHgrow(group, Priority.ALWAYS);
    final HBox box = new HBox(group);
    VBox.setVgrow(box, Priority.ALWAYS);
    box.setId("demoPane");
    return box;
}
 
Example 25
Source Project: marathonv5   Source File: PolylineSample.java    License: Apache License 2.0 5 votes vote down vote up
public PolylineSample() {
    super(180,90);
    // Red stroked not closed triangle
    Polyline polyline1 = new Polyline(new double[]{
        45, 10,
        10, 80,
        80, 80,
    });
    polyline1.setFill(Color.TRANSPARENT);
    polyline1.setStroke(Color.RED);

    // Blue stroked closed triangle
    Polyline polyline2 = new Polyline(new double[]{
        135, 10,
        100, 80,
        170, 80,
        135, 10,
    });
    polyline2.setStroke(Color.DODGERBLUE);
    polyline2.setStrokeWidth(2);
    polyline2.setFill(null);

    
    // Create a group to show all the polylines);
    getChildren().add(new Group(polyline1, polyline2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Polyline 1 Fill", polyline1.fillProperty()),
            new SimplePropertySheet.PropDesc("Polyline 1 Stroke", polyline1.strokeProperty()),
            new SimplePropertySheet.PropDesc("Polyline 2 Stroke", polyline2.strokeProperty())
    );
    // END REMOVE ME
}
 
Example 26
Source Project: phoebus   Source File: PolylineRepresentation.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Group createJFXNode() throws Exception
{
    final Polyline polyline = new Polyline();
    polyline.setStrokeLineJoin(StrokeLineJoin.MITER);
    polyline.setStrokeLineCap(StrokeLineCap.BUTT);
    return new Group(polyline, new Arrow(), new Arrow());
}
 
Example 27
@Override
   public void start(final Stage stage) throws Exception {
final RadialMenuItem item = RadialMenuItemBuilder.create().build();
item.setTranslateX(400);
item.setTranslateY(300);

final DemoUtil demoUtil = new DemoUtil();
demoUtil.addAngleControl("StartAngle", item.startAngleProperty());
demoUtil.addAngleControl("Length", item.lengthProperty());
demoUtil.addRadiusControl("Inner Radius", item.innerRadiusProperty());
demoUtil.addRadiusControl("Radius", item.radiusProperty());
demoUtil.addRadiusControl("Offset", item.offsetProperty());
demoUtil.addColorControl("Background", item.backgroundFillProperty());
demoUtil.addColorControl("BackgroundMouseOn",
	item.backgroundMouseOnFillProperty());
demoUtil.addColorControl("Stroke", item.strokeFillProperty());
demoUtil.addColorControl("StrokeMouseOn",
	item.strokeMouseOnFillProperty());
demoUtil.addBooleanControl("Clockwise", item.clockwiseProperty());
demoUtil.addBooleanControl("BackgroundVisible",
	item.backgroundVisibleProperty());
demoUtil.addBooleanControl("StrokeVisible",
	item.strokeVisibleProperty());
demoUtil.addGraphicControl("Graphic",
	item.graphicProperty());

final Group demoControls = new Group(item, demoUtil);
stage.setScene(new Scene(demoControls));
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
    @Override
    public void handle(final WindowEvent arg0) {
	System.exit(0);
    }
});

stage.setWidth(600);
stage.setHeight(600);
stage.show();
   }
 
Example 28
Source Project: marathonv5   Source File: CurveFittedAreaChartSample.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @inheritDoc
 */
@Override
protected void layoutPlotChildren() {
    super.layoutPlotChildren();
    for (int seriesIndex = 0; seriesIndex < getDataSize(); seriesIndex++) {
        final XYChart.Series<Number, Number> series = getData().get(seriesIndex);
        final Path seriesLine = (Path) ((Group) series.getNode()).getChildren().get(1);
        final Path fillPath = (Path) ((Group) series.getNode()).getChildren().get(0);
        smooth(seriesLine.getElements(), fillPath.getElements());
    }
}
 
Example 29
Source Project: marathonv5   Source File: ProgressSample.java    License: Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 30
Source Project: metastone   Source File: CardToken.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void setScoreValueLowerIsBetter(Group group, int value, int baseValue) {
	Color color = Color.WHITE;
	if (value < baseValue) {
		color = Color.GREEN;
	} else if (value > baseValue) {
		color = Color.RED;
	}
	DigitFactory.showPreRenderedDigits(group, value, color);
}