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


Java LineTo類代碼示例

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


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

示例1: Draw

import javafx.scene.shape.LineTo; //導入依賴的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

示例2: Draw

import javafx.scene.shape.LineTo; //導入依賴的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

示例3: Draw

import javafx.scene.shape.LineTo; //導入依賴的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

示例4: DirectedPath

import javafx.scene.shape.LineTo; //導入依賴的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

示例5: initializeTriangle

import javafx.scene.shape.LineTo; //導入依賴的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

示例6: drawChart

import javafx.scene.shape.LineTo; //導入依賴的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

示例7: handleEvents

import javafx.scene.shape.LineTo; //導入依賴的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

示例8: getRange

import javafx.scene.shape.LineTo; //導入依賴的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

示例9: getCaretShape

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

示例10: createNeedle

import javafx.scene.shape.LineTo; //導入依賴的package包/類
private void createNeedle() {
    double needleWidth  = size * 0.04;
    double needleHeight = size * 0.4675;
    needle.getElements().clear();
    needle.getElements().add(new MoveTo(0.3125 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.3125 * needleWidth, 0.005319148936170213 * needleHeight,
                                              0.4375 * needleWidth, 0.0,
                                              0.5 * needleWidth, 0.0));
    needle.getElements().add(new CubicCurveTo(0.5625 * needleWidth, 0.0,
                                              0.6875 * needleWidth, 0.005319148936170213 * needleHeight,
                                              0.6875 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.6875 * needleWidth, 0.015957446808510637 * needleHeight,
                                              needleWidth, 0.9946808510638298 * needleHeight,
                                              needleWidth, 0.9946808510638298 * needleHeight));
    needle.getElements().add(new LineTo(0.0, 0.9946808510638298 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.0, 0.9946808510638298 * needleHeight,
                                              0.3125 * needleWidth, 0.015957446808510637 * needleHeight,
                                              0.3125 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new ClosePath());
    needle.setFill(new LinearGradient(needle.getLayoutBounds().getMinX(), 0,
                                      needle.getLayoutBounds().getMaxX(), 0,
                                      false, CycleMethod.NO_CYCLE,
                                      new Stop(0.0, gauge.getNeedleColor().darker()),
                                      new Stop(0.5, gauge.getNeedleColor()),
                                      new Stop(1.0, gauge.getNeedleColor().darker())));
}
 
開發者ID:HanSolo,項目名稱:Medusa,代碼行數:27,代碼來源:SectionSkin.java

示例11: drawAverage

import javafx.scene.shape.LineTo; //導入依賴的package包/類
private void drawAverage() {
    double scaledWidth = width * 1.106;
    double centerX     = width * 0.5;
    double centerY     = height * 0.77;
    double minValue    = gauge.getMinValue();
    // Draw average
    average.getElements().clear();
    double averageAngle = START_ANGLE - (gauge.getAverage() - minValue) * angleStep;
    double averageSize  = Helper.clamp(2.0, 2.5, 0.01 * scaledWidth);
    double sinValue     = Math.sin(Math.toRadians(averageAngle));
    double cosValue     = Math.cos(Math.toRadians(averageAngle));
    average.getElements().add(new MoveTo(centerX + scaledWidth * 0.38 * sinValue, centerY + scaledWidth * 0.38 * cosValue));
    sinValue = Math.sin(Math.toRadians(averageAngle - averageSize));
    cosValue = Math.cos(Math.toRadians(averageAngle - averageSize));
    average.getElements().add(new LineTo(centerX + scaledWidth * 0.35 * sinValue, centerY + scaledWidth * 0.35 * cosValue));
    sinValue = Math.sin(Math.toRadians(averageAngle + averageSize));
    cosValue = Math.cos(Math.toRadians(averageAngle + averageSize));
    average.getElements().add(new LineTo(centerX + scaledWidth * 0.35 * sinValue, centerY + scaledWidth * 0.35 * cosValue));
    average.getElements().add(new ClosePath());
    average.setFill(gauge.getAverageColor());
    average.setStroke(gauge.getTickMarkColor());
}
 
開發者ID:HanSolo,項目名稱:Medusa,代碼行數:23,代碼來源:AmpSkin.java

示例12: initGraphics

import javafx.scene.shape.LineTo; //導入依賴的package包/類
private void initGraphics() {
    moveTo     = new MoveTo();
    upperLeft  = new LineTo();
    upperRight = new LineTo();
    lowerRight = new LineTo();
    lowerLeft  = new LineTo();

    path = new Path();
    path.getElements().add(moveTo);
    path.getElements().add(upperLeft);
    path.getElements().add(upperRight);
    path.getElements().add(lowerRight);
    path.getElements().add(lowerLeft);
    path.getElements().add(new ClosePath());

    path.getStyleClass().add("segment");

    pane = new Pane(path);
    pane.getStyleClass().add("segment");

    getChildren().setAll(pane);
}
 
開發者ID:HanSolo,項目名稱:bpmgauge,代碼行數:23,代碼來源:Segment.java

示例13: draw

import javafx.scene.shape.LineTo; //導入依賴的package包/類
/**
 * Draws the arrow-head for its current size and position values.
 */
public void draw() {

    getElements().clear();

    getElements().add(new MoveTo(x, y + length / 2));
    getElements().add(new LineTo(x + width / 2, y - length / 2));

    if (radius > 0) {
        final ArcTo arcTo = new ArcTo();
        arcTo.setX(x - width / 2);
        arcTo.setY(y - length / 2);
        arcTo.setRadiusX(radius);
        arcTo.setRadiusY(radius);
        arcTo.setSweepFlag(true);
        getElements().add(arcTo);
    } else {
        getElements().add(new LineTo(x - width / 2, y - length / 2));
    }

    getElements().add(new ClosePath());
}
 
開發者ID:Heverton,項目名稱:grapheditor,代碼行數:25,代碼來源:ArrowHead.java

示例14: start

import javafx.scene.shape.LineTo; //導入依賴的package包/類
@Override
public void start(Stage stage) throws Exception {
	Path shape = new Path(new MoveTo(450, 450),
               new LineTo(-SIZE, -SIZE),
               new LineTo(0, -2 * SIZE),
               new LineTo(SIZE, -SIZE),
               new LineTo(450, 450),
               new ClosePath());

	shape.setFill(Color.BLUE);
	shape.setStroke(Color.RED);
	shape.setStrokeWidth(2.0);
	shape.getStrokeDashArray().addAll(10.0, 5.0);

	Pane root = new Pane();
	root.getChildren().add(shape);

	stage.setScene(new Scene(root, 900, 900));
	stage.show();
}
 
開發者ID:bourgesl,項目名稱:marlin-fx,代碼行數:21,代碼來源:ShapeOutlineBugRectangle.java

示例15: processPath

import javafx.scene.shape.LineTo; //導入依賴的package包/類
private static Path processPath(final List<String> PATH_LIST, final PathReader READER) {
    final Path PATH = new Path();
    PATH.setFillRule(FillRule.EVEN_ODD);
    while (!PATH_LIST.isEmpty()) {
        if ("M".equals(READER.read())) {
            PATH.getElements().add(new MoveTo(READER.nextX(), READER.nextY()));
        } else if ("L".equals(READER.read())) {
            PATH.getElements().add(new LineTo(READER.nextX(), READER.nextY()));
        } else if ("C".equals(READER.read())) {
            PATH.getElements().add(new CubicCurveTo(READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY()));
        } else if ("Q".equals(READER.read())) {
            PATH.getElements().add(new QuadCurveTo(READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY()));
        } else if ("H".equals(READER.read())) {
            PATH.getElements().add(new HLineTo(READER.nextX()));
        } else if ("L".equals(READER.read())) {
            PATH.getElements().add(new VLineTo(READER.nextY()));
        } else if ("A".equals(READER.read())) {
            PATH.getElements().add(new ArcTo(READER.nextX(), READER.nextY(), 0, READER.nextX(), READER.nextY(), false, false));
        } else if ("Z".equals(READER.read())) {
            PATH.getElements().add(new ClosePath());
        }
    }
    return PATH;
}
 
開發者ID:Simego,項目名稱:FXImgurUploader,代碼行數:25,代碼來源:ShapeConverter.java


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