/* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. */ package helloworld; import javafx.lang.FX; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.LineTo; import javafx.scene.shape.MoveTo; import javafx.scene.shape.Path; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; /** * @author kcr */ public class HelloPath { public void run() { Stage stage = new Stage(); stage.setTitle("Hello Path"); stage.setWidth(600); stage.setHeight(450); Scene scene = new Scene(); scene.setFill(Color.LIGHTGREEN); Path path = new Path(); MoveTo moveTo = new MoveTo(5, 10); LineTo lineTo = new LineTo(15, 10); path.getElements().addAll(moveTo, lineTo); path.setTranslateX(0.5f); path.setTranslateY(0.5f); path.setStroke(Color.RED); scene.getContent().add(path); stage.setScene(scene); stage.setVisible(true); } /** * @param args the command line arguments */ public static void main(String[] args) { FX.start(new Runnable() { public void run() { new HelloPath().run(); } }); } }