different color in path

Richard Bair richard.bair at oracle.com
Fri Jul 12 10:56:49 PDT 2013


No, it is not possible. Each path is a single shape, and all shapes have a single fill / stroke / etc. You will need to use several paths and position them accordingly.

Thanks
Richard

On Jul 13, 2013, at 12:38 AM, fajar <si.siput.ngantuk at gmail.com> wrote:

> 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