different color in path
Gerrit Grunwald
han.solo at muenster.de
Fri Jul 12 10:47:36 PDT 2013
afaik this is not possible. You might want to build the structure out of lines for that you could set the color separately on each line. But this will inly make sense with not too complex paths.
Cheers,
Gerrit
Am 13.07.2013 um 09:38 schrieb fajar <si.siput.ngantuk at gmail.com>:
> 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