当前位置: 首页>>代码示例>>Java>>正文


Java Line.setEndX方法代码示例

本文整理汇总了Java中javafx.scene.shape.Line.setEndX方法的典型用法代码示例。如果您正苦于以下问题:Java Line.setEndX方法的具体用法?Java Line.setEndX怎么用?Java Line.setEndX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.shape.Line的用法示例。


在下文中一共展示了Line.setEndX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setSnapIndicators

import javafx.scene.shape.Line; //导入方法依赖的package包/类
/**
 * Places snap indicators to where the node would be snapped to.
 * @param move True if moving, false if resizing.
 * @param xSnap
 * @param ySnap
 * @param n
 */
private void setSnapIndicators(int xSnap, int ySnap, AbstractNode n, boolean move){
    Line xSnapIndicator = xSnapIndicatorMap.get(n);
    Line ySnapIndicator = ySnapIndicatorMap.get(n);

    xSnapIndicator.setStartX(xSnap);
    xSnapIndicator.setEndX(xSnap);
    xSnapIndicator.setStartY(ySnap);
    if(move){ xSnapIndicator.setEndY(ySnap+Constants.GRID_DISTANCE);
    } else { xSnapIndicator.setEndY(ySnap-Constants.GRID_DISTANCE);}

    ySnapIndicator.setStartX(xSnap);
    if (move) { ySnapIndicator.setEndX(xSnap+Constants.GRID_DISTANCE);
    } else {ySnapIndicator.setEndX(xSnap-Constants.GRID_DISTANCE);}

    ySnapIndicator.setStartY(ySnap);
    ySnapIndicator.setEndY(ySnap);
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:25,代码来源:NodeController.java

示例2: Arrow

import javafx.scene.shape.Line; //导入方法依赖的package包/类
public Arrow(Double fromX, Double fromY, Double toX, Double toY, Double radius) {
	line = new Line();
	line.setStartX(fromX);
	line.setStartY(fromY);
	line.setEndX(toX);
	line.setEndY(toY);
	line.setStrokeWidth(3);
	line.setFill(Color.BLACK);
	
	this.radius = radius;
	
	indicator = createIndicator(toX, toY, radius);
	indicator.setFill(Color.BLACK);
	
	// calcolo il punto esatto in cui deve terminare la linea -- al centro del cerchio
	this.calculateActualEnd();
	
	this.getChildren().addAll(line, indicator);
}
 
开发者ID:steppp,项目名称:Breadth-First-Search,代码行数:20,代码来源:Arrow.java

示例3: playWinAnimation

import javafx.scene.shape.Line; //导入方法依赖的package包/类
private void playWinAnimation(TileCombo combo) {
    Line line = new Line();
    line.setStartX(combo.getTile1().getCenter().getX());
    line.setStartY(combo.getTile1().getCenter().getY());
    line.setEndX(combo.getTile1().getCenter().getX());
    line.setEndY(combo.getTile1().getCenter().getY());
    line.setStroke(Color.YELLOW);
    line.setStrokeWidth(3);

    getGameScene().addUINode(line);

    Timeline timeline = new Timeline();
    timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(1),
            new KeyValue(line.endXProperty(), combo.getTile3().getCenter().getX()),
            new KeyValue(line.endYProperty(), combo.getTile3().getCenter().getY())));
    timeline.setOnFinished(e -> gameOver(combo.getWinSymbol()));
    timeline.play();
}
 
开发者ID:AlmasB,项目名称:FXGLGames,代码行数:19,代码来源:TicTacToeApp.java

示例4: populateLineStyleOptions

import javafx.scene.shape.Line; //导入方法依赖的package包/类
/**
 * Populates the combobox with linestyle options given a width
 * and color.
 * @param penWidth
 * @param penColor
 */
private void populateLineStyleOptions(double penWidth, Color penColor) {
	
	this.getItems().clear();
	
	LineStyle[] styles = LineStyle.values();
	
	for(LineStyle style : styles) {
		Line line = style.getLine();
		line.setStartX(-(WIDTH)/2);
		line.setEndX(WIDTH/2);
		line.setStrokeWidth(penWidth);
		line.setStroke(penColor);
		this.getItems().add(line);
	}
	
}
 
开发者ID:adisrini,项目名称:slogo,代码行数:23,代码来源:LineStyleOptions.java

示例5: scale

import javafx.scene.shape.Line; //导入方法依赖的package包/类
public void scale(int buttonWidth, Font font) {
	for (Node cell : getChildren()) {
		if (cell instanceof Button) {
			((Button) cell).setMinSize(buttonWidth, buttonWidth);
			((Button) cell).setMaxSize(buttonWidth, buttonWidth);
			((Button) cell).setFont(font);
		} else if (cell instanceof Line) {
			Line line = ((Line) cell);
			if (line.getEndX() > 1) {
				line.setEndX(buttonWidth);
			} else if (line.getEndY() > 1) {
				line.setEndY(buttonWidth);
			}
		}
	}
}
 
开发者ID:Henney,项目名称:sudokusolver,代码行数:17,代码来源:SudokuGridPane.java

示例6: createCloseIcon

import javafx.scene.shape.Line; //导入方法依赖的package包/类
private Node createCloseIcon() {
    Group group = new Group();
    group.getStyleClass().add("graphics"); //$NON-NLS-1$

    Circle circle = new Circle();
    circle.getStyleClass().add("circle"); //$NON-NLS-1$
    circle.setRadius(6);
    circle.setCenterX(6);
    circle.setCenterY(6);
    group.getChildren().add(circle);

    Line line1 = new Line();
    line1.getStyleClass().add("line"); //$NON-NLS-1$
    line1.setStartX(4);
    line1.setStartY(4);
    line1.setEndX(8);
    line1.setEndY(8);
    group.getChildren().add(line1);

    Line line2 = new Line();
    line2.getStyleClass().add("line"); //$NON-NLS-1$
    line2.setStartX(8);
    line2.setStartY(4);
    line2.setEndX(4);
    line2.setEndY(8);
    group.getChildren().add(line2);

    return group;
}
 
开发者ID:michaelnetter,项目名称:dracoon-dropzone,代码行数:30,代码来源:MyPopOverSkin.java

示例7: snapshotNode

import javafx.scene.shape.Line; //导入方法依赖的package包/类
private void snapshotNode(Scene scene, Node node) {
    SnapshotParameters params = new SnapshotParameters();
    Bounds layoutBounds = node.getLayoutBounds();
    Bounds bounds = node.localToScene(layoutBounds);

    if (!(bounds.getWidth() > 0 && bounds.getHeight() > 0)) {
        return;
    }

    params.setViewport(new Rectangle2D(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight()));
    WritableImage writable = new WritableImage((int) bounds.getWidth(), (int) bounds.getHeight());
    writable = scene.getRoot().snapshot(params, writable);

    ImageView imageView = new ImageView(writable);
    imageView.getStyleClass().add("snapshot-image");
    imageView.setManaged(false);
    imageView.setLayoutX(bounds.getMinX());
    imageView.setLayoutY(bounds.getMinY());
    imageView.setFitWidth(bounds.getWidth());
    imageView.setFitHeight(bounds.getHeight());

    Region rect = new Region();
    rect.getStyleClass().add("snapshot-background");
    rect.setLayoutX(bounds.getMinX() - 5);
    rect.setLayoutY(bounds.getMinY() - 5);
    rect.resize(bounds.getWidth() + 10, bounds.getHeight() + 10);
    rect.setManaged(false);

    Line line = new Line();
    line.setStartX(bounds.getMaxX() + 4);
    line.setStartY(bounds.getMaxY() + 4);
    line.setEndX(bounds.getMaxX() + 200);
    line.setEndY(bounds.getMaxY() + 200);
    line.setStroke(imagePattern);
    line.setStrokeWidth(5);
    line.setManaged(false);

    getChildren().addAll(rect, imageView); //, line);
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:40,代码来源:IntroPaneSkin.java

示例8: setLine

import javafx.scene.shape.Line; //导入方法依赖的package包/类
public void setLine(Line line, double startX, double startY, double endX, double endY, boolean opaque) {
    line.setStartX(startX);
    line.setStartY(startY);
    line.setEndX(endX);
    line.setEndY(endY);
    line.setOpacity(opaque ? 1 : 0);
}
 
开发者ID:hendrikebbers,项目名称:ExtremeGuiMakeover,代码行数:8,代码来源:AnimatedIcon.java

示例9: start

import javafx.scene.shape.Line; //导入方法依赖的package包/类
@Override
    public void start(Stage primaryStage) throws Exception {
        AnchorPane ap = new AnchorPane();
        final Scene scene = new Scene(ap, 600, 600);
        primaryStage.setScene(scene);
        primaryStage.show();
        
        Line l = new Line();
        l.setFill(Color.AQUAMARINE);
//        l.setLayoutX(300);
//        l.setLayoutY(300);
        l.setStartX(300);
        l.setStartY(300);
        l.setEndX(300);
        l.setEndY(100);
        ap.getChildren().add(l);
        System.out.println("1: " + l.toString() + " tx=" + l.getTranslateX() + ", ty="+l.getTranslateY());
        
//        l.setRotate(45);
//        System.out.println("2: " + l.toString() + " tx=" + l.getTranslateX() + ", ty="+l.getTranslateY());
        // 300, 200
//        l.getTransforms().add(new Rotate(72, 300, 300));
        l.getTransforms().add(new Rotate(144, 300, 300));
//        l.getTransforms().add(new Rotate(216, 300, 300));
//        l.getTransforms().add(new Rotate(288, 300, 300));
        System.out.println("3: " + l.toString() + " tx=" + l.getBoundsInParent().toString() + ", ty="+l.getTranslateY());
        
        /*
            1=centerx,                      centery - 200
            2=centerx + 192.47137451171875, centery - 64.0634765625
            3=centerx + 119.953857421875,   centery + 164.2001953125
            4=centerx - 119.953857421875,   centery + 164.2001953125
            5=centerx - 192.47137451171875, centery - 64.0634765625
        */
    }
 
开发者ID:Naoghuman,项目名称:Incubator,代码行数:36,代码来源:LineRotationForEndPoints.java

示例10: draw

import javafx.scene.shape.Line; //导入方法依赖的package包/类
@Override
public void draw(Line line) {
	line.setStartX(0d);
	line.setStartY(0d);
	line.setEndX(200d);
	line.setEndY(200d);

	line.setStrokeWidth(10);
	line.setStrokeLineCap(StrokeLineCap.BUTT);
	line.getStrokeDashArray().addAll(15d, 5d, 15d, 15d, 20d);
	line.setStrokeDashOffset(10);

}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:14,代码来源:LineDrawItemSkin.java

示例11: draw

import javafx.scene.shape.Line; //导入方法依赖的package包/类
/**
 * Draws the grid for the given width and height.
 *
 * @param width the width of the editor region
 * @param height the height of the editor region
 */
public void draw(final double width, final double height) {

    final double spacing = editorProperties.getGridSpacing();

    getChildren().clear();

    final int hLineCount = (int) Math.floor((height + 1) / spacing);
    final int vLineCount = (int) Math.floor((width + 1) / spacing);

    for (int i = 0; i < hLineCount; i++) {

        final Line hLine = new Line();

        hLine.setStartX(0);
        hLine.setEndX(width);
        hLine.setStartY((i + 1) * spacing + HALF_PIXEL_OFFSET);
        hLine.setEndY((i + 1) * spacing + HALF_PIXEL_OFFSET);
        hLine.strokeProperty().bind(gridColor);

        getChildren().add(hLine);
    }

    for (int i = 0; i < vLineCount; i++) {

        final Line vLine = new Line();

        vLine.setStartX((i + 1) * spacing + HALF_PIXEL_OFFSET);
        vLine.setEndX((i + 1) * spacing + HALF_PIXEL_OFFSET);
        vLine.setStartY(0);
        vLine.setEndY(height);
        vLine.strokeProperty().bind(gridColor);

        getChildren().add(vLine);
    }
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:42,代码来源:GraphEditorGrid.java

示例12: createSeparator

import javafx.scene.shape.Line; //导入方法依赖的package包/类
private Line createSeparator(int width) {
    if (width < 5) {
        width = 200;
    }

    Line sep = new Line();
    sep.setEndX(width);
    sep.setStroke(Color.DARKGREY);
    return sep;
}
 
开发者ID:AlmasB,项目名称:FXGL,代码行数:11,代码来源:FXGLMenu.java

示例13: HangmanImage

import javafx.scene.shape.Line; //导入方法依赖的package包/类
public HangmanImage() {
    Circle head = new Circle(20);
    head.setTranslateX(SPINE_START_X);

    Line spine = new Line();
    spine.setStartX(SPINE_START_X);
    spine.setStartY(SPINE_START_Y);
    spine.setEndX(SPINE_END_X);
    spine.setEndY(SPINE_END_Y);

    Line leftArm = new Line();
    leftArm.setStartX(SPINE_START_X);
    leftArm.setStartY(SPINE_START_Y);
    leftArm.setEndX(SPINE_START_X + 40);
    leftArm.setEndY(SPINE_START_Y + 10);

    Line rightArm = new Line();
    rightArm.setStartX(SPINE_START_X);
    rightArm.setStartY(SPINE_START_Y);
    rightArm.setEndX(SPINE_START_X - 40);
    rightArm.setEndY(SPINE_START_Y + 10);

    Line leftLeg = new Line();
    leftLeg.setStartX(SPINE_END_X);
    leftLeg.setStartY(SPINE_END_Y);
    leftLeg.setEndX(SPINE_END_X + 25);
    leftLeg.setEndY(SPINE_END_Y + 50);

    Line rightLeg = new Line();
    rightLeg.setStartX(SPINE_END_X);
    rightLeg.setStartY(SPINE_END_Y);
    rightLeg.setEndX(SPINE_END_X - 25);
    rightLeg.setEndY(SPINE_END_Y + 50);

    getChildren().addAll(head, spine, leftArm, rightArm, leftLeg, rightLeg);
    lives.set(getChildren().size());
}
 
开发者ID:AlmasB,项目名称:FXTutorials,代码行数:38,代码来源:HangmanMain.java

示例14: playWinAnimation

import javafx.scene.shape.Line; //导入方法依赖的package包/类
private void playWinAnimation(Combo combo) {
    Line line = new Line();
    line.setStartX(combo.tiles[0].getCenterX());
    line.setStartY(combo.tiles[0].getCenterY());
    line.setEndX(combo.tiles[0].getCenterX());
    line.setEndY(combo.tiles[0].getCenterY());

    root.getChildren().add(line);

    Timeline timeline = new Timeline();
    timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(1),
            new KeyValue(line.endXProperty(), combo.tiles[2].getCenterX()),
            new KeyValue(line.endYProperty(), combo.tiles[2].getCenterY())));
    timeline.play();
}
 
开发者ID:AlmasB,项目名称:FXTutorials,代码行数:16,代码来源:TicTacToeApp.java

示例15: Arrow

import javafx.scene.shape.Line; //导入方法依赖的package包/类
private Arrow(Line line, Line arrow1, Line arrow2) {
    super(line, arrow1, arrow2);
    this.line = line;

    /* The color of the arrow should follow the color of the main line. */
    arrow1.strokeProperty().bind(line.strokeProperty());
    arrow2.strokeProperty().bind(line.strokeProperty());

    /* Listener to redraw the arrow parts when the line position changes. */
    InvalidationListener updater = o -> {
        double ex = getEndX();
        double ey = getEndY();
        double sx = getStartX();
        double sy = getStartY();

        arrow1.setEndX(ex);
        arrow1.setEndY(ey);
        arrow2.setEndX(ex);
        arrow2.setEndY(ey);

        if (ex == sx && ey == sy) {
            /* The line is just a point. Don't draw the arrowhead. */
            arrow1.setStartX(ex);
            arrow1.setStartY(ey);
            arrow2.setStartX(ex);
            arrow2.setStartY(ey);
        } else {
            double factor = ARROW_HEAD_LENGTH / Math.hypot(sx-ex, sy-ey);
            double factorO = ARROW_HEAD_WIDTH / Math.hypot(sx-ex, sy-ey);

            // part in direction of main line
            double dx = (sx - ex) * factor;
            double dy = (sy - ey) * factor;

            // part ortogonal to main line
            double ox = (sx - ex) * factorO;
            double oy = (sy - ey) * factorO;

            arrow1.setStartX(ex + dx - oy);
            arrow1.setStartY(ey + dy + ox);
            arrow2.setStartX(ex + dx + oy);
            arrow2.setStartY(ey + dy - ox);
        }
    };

    /* Attach updater to properties */
    startXProperty().addListener(updater);
    startYProperty().addListener(updater);
    endXProperty().addListener(updater);
    endYProperty().addListener(updater);
    updater.invalidated(null);
}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:53,代码来源:Arrow.java


注:本文中的javafx.scene.shape.Line.setEndX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。