different color in path

fajar si.siput.ngantuk at gmail.com
Sat Jul 13 00:38:25 PDT 2013


Is possible to setting different color for individually element in path? 
for example:

package test;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.ArcTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.stage.Stage;

public class TestPath extends Application{

     @Override
     public void start(Stage primaryStage) throws Exception {
         // TODO Auto-generated method stub
         Path path = new Path();

         MoveTo moveTo = new MoveTo();
         moveTo.setX(0.0);
         moveTo.setY(0.0);

         path.setStroke(Color.RED);
         ArcTo arcTo = new ArcTo();
         arcTo.setX(50.0);
         arcTo.setY(50.0);
         arcTo.setRadiusX(50.0);
         arcTo.setRadiusY(50.0);
         path.setStroke(Color.AQUA);

         path.getElements().add(moveTo);
         path.getElements().add(arcTo);

         StackPane pane = new StackPane();

         pane.getChildren().add(path);
         pane.setPrefSize(500, 500);
         primaryStage.setScene(new Scene(pane));
         primaryStage.show();
     }

     public static void main(String[] args){
         launch(args);
     }
}

Is there any possible way to do this?
When above code was running, it was make entire path color changed, not 
particular element on it.



More information about the openjfx-dev mailing list