/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javafx_path;
import javafx.application.Application;
import javafx.scene.Group;
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.stage.Stage;
/**
*
* @web java-buddy.blogspot.com
*/
public class JavaFX_Path extends Application {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("java-buddy.blogspot.com");
Group root = new Group();
Scene scene = new Scene(root, 400, 300, Color.WHITE);
Path path = new Path();
path.getElements().add(new MoveTo(50, 50));
path.getElements().add(new LineTo(50, 200));
path.getElements().add(new LineTo(100, 200));
path.getElements().add(new LineTo(100, 100));
path.getElements().add(new LineTo(200, 100));
path.setStrokeWidth(1);
path.setStroke(Color.BLACK);
root.getChildren().add(path);
primaryStage.setScene(scene);
primaryStage.show();
}
}
No comments:
Post a Comment