Java Code Examples for javafx.scene.Group#setTranslateY()

The following examples show how to use javafx.scene.Group#setTranslateY() . 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 check out the related API usage on the sidebar.
Example 1
Source File: CloseIcon.java    From FxDock with Apache License 2.0 6 votes vote down vote up
public CloseIcon(double size)
{
	super(size);
	
	double r = 0.4 * size;
	double w = 0.075 * size;
	double d = 0.3 * size;
	
	FxPath p = new FxPath();
	p.setStrokeLineCap(StrokeLineCap.ROUND);
	p.setStroke(Color.BLACK);
	p.setStrokeWidth(w);
	p.moveto(-d, -d);
	p.lineto(d, d);
	p.moveto(d, -d);
	p.lineto(-d, d);
	
	Group g = new Group(p);
	g.setTranslateX(size * 0.5);
	g.setTranslateY(size * 0.5);
	
	add(g);
}
 
Example 2
Source File: Main.java    From quantumjava with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private Group createHelpNode() {
    Label help1 = new Label(); //"Pressing X, H or C will\n activate/deactivate the gates");
    help1.textProperty().bind(helpTextProperty);
    help1.setStyle("-fx-background-color: white;-fx-font-size: 1.3em;");

    Group answer = new Group();
    answer.getChildren().addAll(help1);
    answer.setTranslateY((VERTICAL_CELLS-1) * CELL_SIZE);
    answer.setTranslateX((HORIZONTAL_CELLS-3)* CELL_SIZE);
    return answer;

}
 
Example 3
Source File: DataViewerSample.java    From chart-fx with 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 4
Source File: AudioClipSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: AudioClipSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 6
Source File: ClearIcon.java    From FxDock with Apache License 2.0 5 votes vote down vote up
public ClearIcon(double size)
{
	super(size);
	
	double r = 0.4 * size;
	double w = 0.075 * size;
	double d = 0.14 * size;
	
	Circle c = new Circle(0, 0, r);
	c.setFill(null);
	c.setStrokeWidth(0);
	c.setStroke(null);
	c.setFill(Color.LIGHTGRAY);
	
	FxPath p = new FxPath();
	p.setStrokeLineCap(StrokeLineCap.SQUARE);
	p.setStroke(Color.WHITE);
	p.setStrokeWidth(w);
	p.moveto(-d, -d);
	p.lineto(d, d);
	p.moveto(d, -d);
	p.lineto(-d, d);
	
	Group g = new Group(c, p);
	g.setTranslateX(size * 0.5);
	g.setTranslateY(size * 0.5);
	
	add(g);
}
 
Example 7
Source File: FindIcon.java    From FxDock with Apache License 2.0 5 votes vote down vote up
public FindIcon(double size)
{
	super(size);
	
	double r = 0.3 * size;
	double w = 0.075 * size;
	double gap = 0.12 * size;
	double handle = 0.15 * size;

	Circle c = new Circle(0, 0, r);
	c.setFill(null);
	c.setStrokeWidth(w);
	c.setStroke(Color.BLACK);
	c.setFill(null);
	
	FxPath p = new FxPath();
	p.setStrokeLineCap(StrokeLineCap.SQUARE);
	p.setStroke(Color.BLACK);
	p.setStrokeWidth(w);
	p.moveto(r, 0);
	p.lineto(r + gap, 0);
	
	FxPath h = new FxPath();
	h.setStrokeLineCap(StrokeLineCap.ROUND);
	h.setStroke(Color.BLACK);
	h.setStrokeWidth(w * 2);
	h.moveto(r + gap, 0);
	h.lineto(r + gap + handle, 0);
	
	Group g = new Group(c, p, h);
	g.setRotate(135);
	g.setTranslateX(size * 0.30);
	g.setTranslateY(size * 0.54);
	
	add(g);
}
 
Example 8
Source File: StarIcon.java    From FxDock with Apache License 2.0 4 votes vote down vote up
public StarIcon(double size, Color fill)
{
	super(size);
	
	double rm = size * 0.4;
	double r0 = size * 0.15;
	double w = size * 0.0325;
	
	FxPath p = new FxPath();
	p.setStrokeLineCap(StrokeLineCap.ROUND);
	p.setStrokeLineJoin(StrokeLineJoin.ROUND);
	p.setStroke(Color.BLACK);
	p.setStrokeWidth(w);
	p.setFill(fill);

	for(int i=0; i<11; i++)
	{
		double a = Math.PI * i / 5;
		double r = CKit.isEven(i) ? rm : r0;
		double x = r * Math.cos(a);
		double y = r * Math.sin(a);
		
		switch(i)
		{
		case 0:
			p.moveto(x, y);
			break;
		case 10:
			p.close();
			break;
		default:
			p.lineto(x, y);
			break;
		}
	}
	
	Group g = new Group(p);
	g.setRotate(-90);
	g.setTranslateX(size * 0.5);
	g.setTranslateY(size * 0.5);
	
	add(g);
}