本文整理汇总了Java中eu.hansolo.medusa.tools.ConicalGradient类的典型用法代码示例。如果您正苦于以下问题:Java ConicalGradient类的具体用法?Java ConicalGradient怎么用?Java ConicalGradient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConicalGradient类属于eu.hansolo.medusa.tools包,在下文中一共展示了ConicalGradient类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resize
import eu.hansolo.medusa.tools.ConicalGradient; //导入依赖的package包/类
@Override protected void resize() {
double width = gauge.getWidth() - gauge.getInsets().getLeft() - gauge.getInsets().getRight();
double height = gauge.getHeight() - gauge.getInsets().getTop() - gauge.getInsets().getBottom();
size = width < height ? width : height;
if (width > 0 && height > 0) {
pane.setMaxSize(size, size);
pane.setPrefSize(size, size);
pane.relocate((width - size) * 0.5, (height - size) * 0.5);
center = size * 0.5;
circle.setCenterX(center);
circle.setCenterY(center);
circle.setRadius(size * 0.44);
circle.setStrokeWidth(size * 0.11);
arc.setCenterX(center);
arc.setCenterY(center);
arc.setRadiusX(size * 0.44);
arc.setRadiusY(size * 0.44);
arc.setStrokeWidth(size * 0.11);
shadow.setRadius(0.03 * size);
shadow.setOffsetX(0.03 * size);
Color barColor = gauge.getBarColor();
double currentValue = gauge.getCurrentValue();
List<Stop> gradientBarStops = gauge.getGradientBarStops();
circle.setStroke(Color.color(barColor.getRed(), barColor.getGreen(), barColor.getBlue(), 0.13));
Rectangle bounds = new Rectangle(0, 0, size, size);
gradient = new ConicalGradient(center, center, ScaleDirection.CLOCKWISE, gradientBarStops);
arc.setStroke(gradient.getImagePattern(bounds));
arc.setLength(currentValue * angleStep);
fakeDot.setRadius(size * 0.055);
fakeDot.setFill(gradientBarStops.get(0).getColor());
dot.setRadius(size * 0.055);
dot.setFill(gradientBarStops.get(3).getColor());
dot.setCenterX(center + arc.getRadiusX() * Math.sin(Math.toRadians(180 - currentValue * angleStep)));
dot.setCenterY(center + arc.getRadiusY() * Math.cos(Math.toRadians(180 - currentValue * angleStep)));
titleText.setFill(barColor);
resizeTitleText();
resizeValueText();
resizeUnitText();
redraw();
}
}