當前位置: 首頁>>代碼示例>>Java>>正文


Java MoveTo類代碼示例

本文整理匯總了Java中javafx.scene.shape.MoveTo的典型用法代碼示例。如果您正苦於以下問題:Java MoveTo類的具體用法?Java MoveTo怎麽用?Java MoveTo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MoveTo類屬於javafx.scene.shape包,在下文中一共展示了MoveTo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clearSmallPolygons

import javafx.scene.shape.MoveTo; //導入依賴的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));
                }
            } 
        }
    }
}
 
開發者ID:gluonhq,項目名稱:javaone2016,代碼行數:26,代碼來源:BadgeOutline.java

示例2: Draw

import javafx.scene.shape.MoveTo; //導入依賴的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);
}
 
開發者ID:andrewsarnold,項目名稱:FlagMaker-2,代碼行數:20,代碼來源:DivisionBendsForward.java

示例3: Draw

import javafx.scene.shape.MoveTo; //導入依賴的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);
}
 
開發者ID:andrewsarnold,項目名稱:FlagMaker-2,代碼行數:20,代碼來源:DivisionX.java

示例4: Draw

import javafx.scene.shape.MoveTo; //導入依賴的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);
}
 
開發者ID:andrewsarnold,項目名稱:FlagMaker-2,代碼行數:20,代碼來源:DivisionBendsBackward.java

示例5: DirectedPath

import javafx.scene.shape.MoveTo; //導入依賴的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");
}
 
開發者ID:dmusican,項目名稱:Elegit,代碼行數:28,代碼來源:DirectedPath.java

示例6: createIconContent

import javafx.scene.shape.MoveTo; //導入依賴的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;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:PathSample.java

示例7: drawingAreaMouseClicked

import javafx.scene.shape.MoveTo; //導入依賴的package包/類
@FXML
private void drawingAreaMouseClicked(MouseEvent e)
{
   polyline.getPoints().addAll(e.getX(), e.getY());
   polygon.getPoints().addAll(e.getX(), e.getY());
 
   // if path is empty, move to first click position and close path
   if (path.getElements().isEmpty())
   {
      path.getElements().add(new MoveTo(e.getX(), e.getY()));
      path.getElements().add(new ClosePath());      
   }
   else // insert a new path segment before the ClosePath element
   {
      // create an arc segment and insert it in the path
      ArcTo arcTo = new ArcTo();
      arcTo.setX(e.getX());
      arcTo.setY(e.getY());
      arcTo.setRadiusX(100.0);
      arcTo.setRadiusY(100.0);
      arcTo.setSweepFlag(sweepFlag);
      sweepFlag = !sweepFlag;
      path.getElements().add(path.getElements().size() - 1, arcTo);
   }
}
 
開發者ID:cleitonferreira,項目名稱:LivroJavaComoProgramar10Edicao,代碼行數:26,代碼來源:PolyShapesController.java

示例8: initializeTriangle

import javafx.scene.shape.MoveTo; //導入依賴的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;
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:26,代碼來源:ChannelSenderArrowHead.java

示例9: initializeHalfCircle

import javafx.scene.shape.MoveTo; //導入依賴的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;
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:21,代碼來源:HandshakeChannelSenderArrowHead.java

示例10: initializeLargeCircle

import javafx.scene.shape.MoveTo; //導入依賴的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;
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:21,代碼來源:BroadcastChannelSenderArrowHead.java

示例11: initializeMediumCircle

import javafx.scene.shape.MoveTo; //導入依賴的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;
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:21,代碼來源:BroadcastChannelSenderArrowHead.java

示例12: initializeSmallCircle

import javafx.scene.shape.MoveTo; //導入依賴的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;
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:21,代碼來源:BroadcastChannelSenderArrowHead.java

示例13: drawChart

import javafx.scene.shape.MoveTo; //導入依賴的package包/類
private void drawChart(final List<Point> POINTS) {
    if (POINTS.isEmpty()) return;
    Point[] points = smoothing ? Helper.subdividePoints(POINTS.toArray(new Point[0]), 8) : POINTS.toArray(new Point[0]);

    fillPath.getElements().clear();
    fillPath.getElements().add(new MoveTo(0, height));

    strokePath.getElements().clear();
    strokePath.getElements().add(new MoveTo(points[0].getX(), points[0].getY()));

    for (Point p : points) {
        fillPath.getElements().add(new LineTo(p.getX(), p.getY()));
        strokePath.getElements().add(new LineTo(p.getX(), p.getY()));
    }

    fillPath.getElements().add(new LineTo(width, height));
    fillPath.getElements().add(new LineTo(0, height));
    fillPath.getElements().add(new ClosePath());

    if (dataPointsVisible) { drawDataPoints(POINTS, tile.isFillWithGradient() ? tile.getGradientStops().get(0).getColor() : tile.getBarColor()); }
}
 
開發者ID:HanSolo,項目名稱:tilesfx,代碼行數:22,代碼來源:SmoothAreaChartTileSkin.java

示例14: handleEvents

import javafx.scene.shape.MoveTo; //導入依賴的package包/類
@Override protected void handleEvents(final String EVENT_TYPE) {
    super.handleEvents(EVENT_TYPE);

    if ("VISIBILITY".equals(EVENT_TYPE)) {
        Helper.enableNode(titleText, !tile.getTitle().isEmpty());
        Helper.enableNode(valueText, tile.isValueVisible());
        Helper.enableNode(timeSpanText, !tile.isTextVisible());
        redraw();
    } else if ("VALUE".equals(EVENT_TYPE)) {
        if(tile.isAnimated()) { tile.setAnimated(false); }
        if (!tile.isAveragingEnabled()) { tile.setAveragingEnabled(true); }
        double value = clamp(minValue, maxValue, tile.getValue());
        addData(value);
        handleCurrentValue(value);
    } else if ("AVERAGING".equals(EVENT_TYPE)) {
        noOfDatapoints = tile.getAveragingPeriod();
        // To get smooth lines in the chart we need at least 4 values
        if (noOfDatapoints < 4) throw new IllegalArgumentException("Please increase the averaging period to a value larger than 3.");
        for (int i = 0; i < noOfDatapoints; i++) { dataList.add(minValue); }
        pathElements.clear();
        pathElements.add(0, new MoveTo());
        for (int i = 1 ; i < noOfDatapoints ; i++) { pathElements.add(i, new LineTo()); }
        sparkLine.getElements().setAll(pathElements);
        redraw();
    }
}
 
開發者ID:HanSolo,項目名稱:tilesfx,代碼行數:27,代碼來源:StockTileSkin.java

示例15: getRange

import javafx.scene.shape.MoveTo; //導入依賴的package包/類
/** returns selection shape for a given range */
public PathElement[] getRange(int start, int end)
{
	if(center instanceof CTextFlow)
	{
		CTextFlow t = (CTextFlow)center;
		return t.getRange(start, end);
	}
	else
	{
		double w = center.getWidth();
		double h = center.getHeight();
		
		return new PathElement[]
		{
			new MoveTo(0, 0),
			new LineTo(w, 0),
			new LineTo(w, h),
			new LineTo(0, h),
			new LineTo(0, 0)
		};
	}
}
 
開發者ID:andy-goryachev,項目名稱:FxEditor,代碼行數:24,代碼來源:LineBox.java


注:本文中的javafx.scene.shape.MoveTo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。