, , . , . .
com.sun.prism.j2d.J2DPrismGraphics, , fill():
void fill(java.awt.Shape shape) {
if (paintWasProportional) {
if (nodeBounds != null) {
g2d.setPaint(toJ2DPaint(paint, nodeBounds));
} else {
g2d.setPaint(toJ2DPaint(paint, shape.getBounds2D()));
}
}
g2d.fill(shape);
}
paintWasProportional , .
LinearGradient, , . :
@Override
public void start(Stage primaryStage) throws Exception {
Group group = new Group();
primaryStage.setScene(new Scene(group, 200, 350));
Line line = new Line(100, 50, 100, 300);
LinearGradient linearGradient = new LinearGradient(0d, 0d, 0d, 1d, true,
CycleMethod.NO_CYCLE, new Stop(0,Color.RED),new Stop(1,Color.GREEN));
line.setStrokeWidth(36);
line.setStroke(linearGradient);
group.getChildren().add(line);
primaryStage.show();
}
( ):

, to right, , :
LinearGradient linearGradient = new LinearGradient(0d, 50d, 0d, 300d,
false, CycleMethod.REFLECT,new Stop(0,Color.RED), new Stop(1,Color.GREEN));
.
, , :
LinearGradient linearGradient = new LinearGradient(100-18d, 0d, 100+18d, 0d,
false, CycleMethod.REFLECT,new Stop(0,Color.RED), new Stop(1,Color.GREEN));
:

, CSS.