本文整理汇总了Java中javafx.scene.shape.Path类的典型用法代码示例。如果您正苦于以下问题:Java Path类的具体用法?Java Path怎么用?Java Path使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Path类属于javafx.scene.shape包,在下文中一共展示了Path类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearSmallPolygons
import javafx.scene.shape.Path; //导入依赖的package包/类
private void clearSmallPolygons(Path... paths){
validPaths = new ArrayList<>();
Point2D p0 = Point2D.ZERO;
for (Path path : paths) {
for (PathElement elem : path.getElements()) {
if (elem instanceof MoveTo) {
elements = new ArrayList<>();
elements.add(elem);
listPoints = new ArrayList<>();
p0 = new Point2D(((MoveTo)elem).getX(), ((MoveTo)elem).getY());
listPoints.add(p0);
} else if (elem instanceof CubicCurveTo) {
elements.add(elem);
Point2D ini = listPoints.size() > 0 ? listPoints.get(listPoints.size() - 1) : p0;
listPoints.addAll(evalCubicCurve((CubicCurveTo) elem, ini, POINTS_CURVE));
} else if (elem instanceof ClosePath) {
elements.add(elem);
listPoints.add(p0);
if (Math.abs(calculateArea()) > MINIMUM_AREA) {
validPaths.add(new Path(elements));
}
}
}
}
}
示例2: Draw
import javafx.scene.shape.Path; //导入依赖的package包/类
@Override
public void Draw(Pane canvas)
{
double height = canvas.getHeight();
double width = canvas.getWidth();
canvas.getChildren().add(new Rectangle(width, height, Colors[0]));
Path p = new Path(new PathElement[]
{
new MoveTo(width, 0),
new LineTo(width, height),
new LineTo(0, height),
new LineTo(width, 0)
});
p.fillProperty().set(Colors[1]);
p.strokeWidthProperty().set(0);
canvas.getChildren().add(p);
}
示例3: Draw
import javafx.scene.shape.Path; //导入依赖的package包/类
@Override
public void Draw(Pane canvas)
{
double height = canvas.getHeight();
double width = canvas.getWidth();
canvas.getChildren().add(new Rectangle(width, height, Colors[0]));
Path p = new Path(new PathElement[]
{
new MoveTo(0, height),
new LineTo(width, 0),
new LineTo(width, height),
new LineTo(0, 0)
});
p.fillProperty().set(Colors[1]);
p.strokeWidthProperty().set(0);
canvas.getChildren().add(p);
}
示例4: Draw
import javafx.scene.shape.Path; //导入依赖的package包/类
@Override
public void Draw(Pane canvas)
{
double height = canvas.getHeight();
double width = canvas.getWidth();
canvas.getChildren().add(new Rectangle(width, height, Colors[0]));
Path p = new Path(new PathElement[]
{
new MoveTo(width, height),
new LineTo(0, height),
new LineTo(0, 0),
new LineTo(width, height)
});
p.fillProperty().set(Colors[1]);
p.strokeWidthProperty().set(0);
canvas.getChildren().add(p);
}
示例5: DirectedPath
import javafx.scene.shape.Path; //导入依赖的package包/类
/**
* Constructs and binds the appropriate properties for the line and
* the arrow
*/
public DirectedPath(DoubleBinding startX, DoubleBinding startY,
DoubleBinding endX,DoubleBinding endY){
this.path = new Path();
MoveTo start = new MoveTo();
start.xProperty().bind(startX);
start.yProperty().bind(startY);
LineTo end = new LineTo();
end.xProperty().bind(endX);
end.yProperty().bind(endY);
path.getElements().add(start);
path.getElements().add(end);
this.arrow = getArrow();
this.getChildren().add(path);
this.getChildren().add(arrow);
this.path.getStyleClass().setAll("edge");
}
示例6: seriesAdded
import javafx.scene.shape.Path; //导入依赖的package包/类
@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) {
// handle any data already in series
for (int j = 0; j < series.getData().size(); j++) {
Data item = series.getData().get(j);
Node candle = createCandle(seriesIndex, item, j);
if (shouldAnimate()) {
candle.setOpacity(0);
getPlotChildren().add(candle);
// fade in new candle
FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
ft.setToValue(1);
ft.play();
} else {
getPlotChildren().add(candle);
}
}
// create series path
Path seriesPath = new Path();
seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
series.setNode(seriesPath);
getPlotChildren().add(seriesPath);
}
示例7: createIconContent
import javafx.scene.shape.Path; //导入依赖的package包/类
public static Node createIconContent() {
Path path = new Path();
path.getElements().addAll(
new MoveTo(25, 25),
new HLineTo(45),
new ArcTo(20, 20, 0, 80, 25, true, true)
);
path.setStroke(Color.web("#b9c0c5"));
path.setStrokeWidth(5);
path.getStrokeDashArray().addAll(15d,15d);
path.setFill(null);
javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
effect.setOffsetX(1);
effect.setOffsetY(1);
effect.setRadius(3);
effect.setColor(Color.rgb(0,0,0,0.6));
path.setEffect(effect);
return path;
}
示例8: seriesChanged
import javafx.scene.shape.Path; //导入依赖的package包/类
@Override
protected void seriesChanged(Change<? extends MultiAxisChart.Series<X, Y>> c) {
// Update style classes for all series lines and symbols
// Note: is there a more efficient way of doing this?
for (int i = 0; i < getDataSize(); i++) {
final MultiAxisChart.Series<X, Y> s = getData().get(i);
Path seriesLine = (Path) ((Group) s.getNode()).getChildren().get(1);
Path fillPath = (Path) ((Group) s.getNode()).getChildren().get(0);
seriesLine.getStyleClass().setAll("chart-series-area-line", "series" + i, s.defaultColorStyleClass);
fillPath.getStyleClass().setAll("chart-series-area-fill", "series" + i, s.defaultColorStyleClass);
for (int j = 0; j < s.getData().size(); j++) {
final Data<X, Y> item = s.getData().get(j);
final Node node = item.getNode();
if (node != null)
node.getStyleClass().setAll("chart-area-symbol", "series" + i, "data" + j,
s.defaultColorStyleClass);
}
}
}
示例9: updateDefaultColorIndex
import javafx.scene.shape.Path; //导入依赖的package包/类
private void updateDefaultColorIndex(final MultiAxisChart.Series<X, Y> series) {
int clearIndex = seriesColorMap.get(series);
Path seriesLine = (Path) ((Group) series.getNode()).getChildren().get(1);
Path fillPath = (Path) ((Group) series.getNode()).getChildren().get(0);
if (seriesLine != null) {
seriesLine.getStyleClass().remove(DEFAULT_COLOR + clearIndex);
}
if (fillPath != null) {
fillPath.getStyleClass().remove(DEFAULT_COLOR + clearIndex);
}
for (int j = 0; j < series.getData().size(); j++) {
final Node node = series.getData().get(j).getNode();
if (node != null) {
node.getStyleClass().remove(DEFAULT_COLOR + clearIndex);
}
}
}
示例10: bindToColor
import javafx.scene.shape.Path; //导入依赖的package包/类
public void bindToColor(final ObjectProperty<Color> color, final ObjectProperty<Color.Intensity> intensity, final boolean doColorBackground) {
final BiConsumer<Color, Color.Intensity> recolor = (newColor, newIntensity) -> {
final JFXTextField textField = (JFXTextField) lookup("#textField");
textField.setUnFocusColor(TRANSPARENT);
textField.setFocusColor(newColor.getColor(newIntensity));
if (doColorBackground) {
final Path shape = (Path) lookup("#shape");
shape.setFill(newColor.getColor(newIntensity.next(-1)));
shape.setStroke(newColor.getColor(newIntensity.next(-1).next(2)));
textField.setStyle("-fx-prompt-text-fill: rgba(255, 255, 255, 0.6); -fx-text-fill: " + newColor.getTextColorRgbaString(newIntensity) + ";");
textField.setFocusColor(newColor.getTextColor(newIntensity));
} else {
textField.setStyle("-fx-prompt-text-fill: rgba(0, 0, 0, 0.6);");
}
};
color.addListener(observable -> recolor.accept(color.get(), intensity.get()));
intensity.addListener(observable -> recolor.accept(color.get(), intensity.get()));
recolor.accept(color.get(), intensity.get());
}
示例11: initializeTriangle
import javafx.scene.shape.Path; //导入依赖的package包/类
private Path initializeTriangle() {
final Path triangle = new Path();
MoveTo start = new MoveTo();
LineTo l1 = new LineTo();
LineTo l2 = new LineTo();
LineTo l3 = new LineTo();
start.xProperty().bind(ax);
start.yProperty().bind(ay);
l1.xProperty().bind(bx);
l1.yProperty().bind(by);
l2.xProperty().bind(cx);
l2.yProperty().bind(cy);
l3.xProperty().bind(ax);
l3.yProperty().bind(ay);
triangle.setFill(Color.BLACK);
triangle.getElements().addAll(start, l1, l2, l3);
return triangle;
}
示例12: initializeHalfCircle
import javafx.scene.shape.Path; //导入依赖的package包/类
private Path initializeHalfCircle() {
final Path halfCircle = new Path();
halfCircle.setStroke(Color.BLACK);
MoveTo p1 = new MoveTo();
ArcTo p2 = new ArcTo();
p1.xProperty().bind(xProperty().add(CIRCLE_RADIUS));
p1.yProperty().bind(yProperty());
p2.xProperty().bind(xProperty().subtract(CIRCLE_RADIUS));
p2.yProperty().bind(yProperty());
p2.setRadiusX(CIRCLE_RADIUS);
p2.setRadiusY(CIRCLE_RADIUS);
halfCircle.getElements().add(p1);
halfCircle.getElements().add(p2);
return halfCircle;
}
示例13: initializeLargeCircle
import javafx.scene.shape.Path; //导入依赖的package包/类
private Path initializeLargeCircle() {
final Path largeCircle = new Path();
largeCircle.setStroke(Color.BLACK);
MoveTo p1 = new MoveTo();
ArcTo p2 = new ArcTo();
p1.xProperty().bind(xProperty().add(LARGE_CIRCLE_RADIUS));
p1.yProperty().bind(yProperty());
p2.xProperty().bind(xProperty().subtract(LARGE_CIRCLE_RADIUS));
p2.yProperty().bind(yProperty());
p2.setRadiusX(LARGE_CIRCLE_RADIUS);
p2.setRadiusY(LARGE_CIRCLE_RADIUS);
largeCircle.getElements().add(p1);
largeCircle.getElements().add(p2);
return largeCircle;
}
示例14: initializeMediumCircle
import javafx.scene.shape.Path; //导入依赖的package包/类
private Path initializeMediumCircle() {
final Path mediumCircle = new Path();
mediumCircle.setStroke(Color.BLACK);
MoveTo p1 = new MoveTo();
ArcTo p2 = new ArcTo();
p1.xProperty().bind(xProperty().add(MEDIUM_CIRCLE_RADIUS));
p1.yProperty().bind(yProperty());
p2.xProperty().bind(xProperty().subtract(MEDIUM_CIRCLE_RADIUS));
p2.yProperty().bind(yProperty());
p2.setRadiusX(MEDIUM_CIRCLE_RADIUS);
p2.setRadiusY(MEDIUM_CIRCLE_RADIUS);
mediumCircle.getElements().add(p1);
mediumCircle.getElements().add(p2);
return mediumCircle;
}
示例15: initializeSmallCircle
import javafx.scene.shape.Path; //导入依赖的package包/类
private Path initializeSmallCircle() {
final Path smallCircle = new Path();
smallCircle.setStroke(Color.BLACK);
MoveTo p1 = new MoveTo();
ArcTo p2 = new ArcTo();
p1.xProperty().bind(xProperty().add(SMALL_CIRCLE_RADIUS));
p1.yProperty().bind(yProperty());
p2.xProperty().bind(xProperty().subtract(SMALL_CIRCLE_RADIUS));
p2.yProperty().bind(yProperty());
p2.setRadiusX(SMALL_CIRCLE_RADIUS);
p2.setRadiusY(SMALL_CIRCLE_RADIUS);
smallCircle.getElements().add(p1);
smallCircle.getElements().add(p2);
return smallCircle;
}