Java examples for JavaFX:Transform
Translate a line in JavaFX
import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.Line; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { Application.launch(args);//from w w w . j av a 2 s .c o m } @Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 306, 550, Color.WHITE); Line blackLine = new Line(); blackLine.setStartX(170); blackLine.setStartY(30); blackLine.setEndX(20); blackLine.setEndY(140); blackLine.setFill(Color.BLACK); blackLine.setStrokeWidth(10.0f); blackLine.setTranslateY(20); root.getChildren().add(blackLine); primaryStage.setScene(scene); primaryStage.show(); } }