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


Java CubicCurve.setControlX1方法代码示例

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


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

示例1: createIconContent

import javafx.scene.shape.CubicCurve; //导入方法依赖的package包/类
public static Node createIconContent() {
    CubicCurve cubicCurve = new CubicCurve();
    cubicCurve.setStartX(0);
    cubicCurve.setStartY(50);
    cubicCurve.setControlX1(20);
    cubicCurve.setControlY1(0);
    cubicCurve.setControlX2(70);
    cubicCurve.setControlY2(100);
    cubicCurve.setEndX(80);
    cubicCurve.setEndY(50);
    cubicCurve.setStroke(Color.web("#b9c0c5"));
    cubicCurve.setStrokeWidth(5);
    cubicCurve.getStrokeDashArray().addAll(15d,15d);
    cubicCurve.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));
    cubicCurve.setEffect(effect);
    return cubicCurve;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:CubicCurveSample.java

示例2: createStartingCurve

import javafx.scene.shape.CubicCurve; //导入方法依赖的package包/类
/**
 * Creates the starting Bezier curve and its controls.
 * @return
 */
CubicCurve createStartingCurve() {
	curve = new CubicCurve();
	curve.setStartX(START_X);
	curve.setStartY(START_Y);
	curve.setControlX1(CONTROL_X1);
	curve.setControlY1(CONTROL_Y1);
	curve.setControlX2(CONTROL_X2);
	curve.setControlY2(CONTROL_Y2);
	curve.setEndX(END_X);
	curve.setEndY(END_Y);
	curve.setStroke(Color.CADETBLUE);
	curve.setStrokeWidth(WIDTH);
	curve.setStrokeLineCap(StrokeLineCap.ROUND);
	curve.setFill(Color.CORNSILK.deriveColor(0, SATURATION_FACTOR, 1, OPACITY_FACTOR));
	this.getChildren().add(curve);
	return curve;
}
 
开发者ID:sjain28,项目名称:Game-Engine-Vooga,代码行数:22,代码来源:BezierCurve.java

示例3: CubicCurveSample

import javafx.scene.shape.CubicCurve; //导入方法依赖的package包/类
public CubicCurveSample() {
    super(180,90);
    // Create cubicCurve shape
    CubicCurve cubicCurve = new CubicCurve();
    cubicCurve.setStartX(0);
    cubicCurve.setStartY(45);
    cubicCurve.setControlX1(30);
    cubicCurve.setControlY1(10);
    cubicCurve.setControlX2(150);
    cubicCurve.setControlY2(80);
    cubicCurve.setEndX(180);
    cubicCurve.setEndY(45);
    cubicCurve.setStroke(Color.RED);
    cubicCurve.setFill(Color.ROSYBROWN);
    cubicCurve.setStrokeWidth(2d);

    // show the cubicCurve shape;
    getChildren().add(cubicCurve);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Cubic Curve Fill", cubicCurve.fillProperty()),
            new SimplePropertySheet.PropDesc("Cubic Curve Stroke", cubicCurve.strokeProperty()),
            new SimplePropertySheet.PropDesc("Cubic Curve Start X", cubicCurve.startXProperty(), 0d, 170d),
            new SimplePropertySheet.PropDesc("Cubic Curve Start Y", cubicCurve.startYProperty(), 10d, 80d),
            new SimplePropertySheet.PropDesc("Cubic Curve Control X1", cubicCurve.controlX1Property(), 0d, 180d),
            new SimplePropertySheet.PropDesc("Cubic Curve Control Y1", cubicCurve.controlY1Property(), 0d, 90d),
            new SimplePropertySheet.PropDesc("Cubic Curve Control X2", cubicCurve.controlX2Property(), 0d, 180d),
            new SimplePropertySheet.PropDesc("Cubic Curve Control Y2", cubicCurve.controlY2Property(), 0d, 90d),
            new SimplePropertySheet.PropDesc("Cubic Curve End X", cubicCurve.endXProperty(), 10d, 180d),
            new SimplePropertySheet.PropDesc("Cubic Curve End Y", cubicCurve.endYProperty(), 10d, 80d)
    );
    // END REMOVE ME
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:34,代码来源:CubicCurveSample.java

示例4: updateBezierControlPoints

import javafx.scene.shape.CubicCurve; //导入方法依赖的package包/类
/** Updates the Bezier offset (curviness) according to the current start and end positions. */
protected static void updateBezierControlPoints(CubicCurve wire) {
    double yOffset = getBezierYOffset(wire);
    wire.setControlX1(wire.getStartX());
    wire.setControlY1(wire.getStartY() + yOffset);
    wire.setControlX2(wire.getEndX());
    wire.setControlY2(wire.getEndY() - yOffset);
}
 
开发者ID:viskell,项目名称:viskell,代码行数:9,代码来源:Connection.java

示例5: setupLine

import javafx.scene.shape.CubicCurve; //导入方法依赖的package包/类
/**
 * setupLine. This method is invoked whenever a line is being
 * created. Both the coordinates and the event are set here.
 * @return Returns the line created.
 */
public CubicCurve setupLine()
{
    /* Appropriate circle. */
    Circle io = (nodeBoxSource == null) ? nodeBoxTarget.getNode().getInput()
            : nodeBoxSource.getNode().getOutput();

    /* Calculate the coordinates. */
    Coordinates coordinates = new Coordinates();
    Bounds bounds = io.localToScene( io.getBoundsInLocal() );
    coordinates.setX( (bounds.getMinX() + (bounds.getWidth()  / 2)) - 50 );
    coordinates.setY(  bounds.getMinY() + (bounds.getHeight() / 2)       );

    /* Create the line and setup the properties. */
    line = new CubicCurve();
    line.setFill(Color.TRANSPARENT);
    line.setStartX   ( coordinates.getX() );
    line.setStartY   ( coordinates.getY() );
    line.setControlX1( coordinates.getX() );
    line.setControlX2( coordinates.getX() );
    line.setControlY1( coordinates.getY() );
    line.setControlY2( coordinates.getY() );
    line.setEndX     ( coordinates.getX() );
    line.setEndY     ( coordinates.getY() );
    line.setStroke(Color.GREENYELLOW);
    line.setStrokeWidth(2);

    /*
     * Setup the mouse move event for the line, note
     * that we are using the workspace to handle the
     * event, since we need track the workspace.
     */
    filter = new EventHandler<MouseEvent>() {
        private Edge.IO io = Edge.this.lastConnection;

        @Override
        public void handle(MouseEvent event) {
            /* There's a line being created. */
            if (NodeBoxController.connAcc){
                double diff = Math.abs (Edge.this.line.getEndX() - Edge.this.line.getStartX());
                diff = (diff * 0.4);

                if (io.equals(IO.Input))
                    diff *= -1;

                Edge.this.line.setControlX1( Edge.this.line.getStartX() + diff );
                Edge.this.line.setControlY1( Edge.this.line.getStartY() );
                Edge.this.line.setControlX2( Edge.this.line.getEndX  () - diff );
                Edge.this.line.setControlY2( Edge.this.line.getEndY  () );

                Edge.this.line.setEndX( event.getX() );
                Edge.this.line.setEndY( event.getY() );
            }

            /* Consume event. */
            event.consume();
        }
    };

    /* Adds the event filter. */
    MainController.getInstance().getCurrentWorkspace().addEventFilter(MouseEvent.MOUSE_MOVED, filter);
    return line;
}
 
开发者ID:Theldus,项目名称:PSE,代码行数:68,代码来源:Edge.java

示例6: setType

import javafx.scene.shape.CubicCurve; //导入方法依赖的package包/类
public void setType (DragIconType type) {
	
	mType = type;
	
	getStyleClass().clear();
	getStyleClass().add("dragicon");
	
	//added because the cubic curve will persist into other icons
	if (this.getChildren().size() > 0)
		getChildren().clear();
	
	switch (mType) {
	
	case cubic_curve:
		getStyleClass().add("icon-yellow");
		
		Pane  pane = new Pane();
		
		pane.setPrefWidth(64.0);
		pane.setPrefHeight(64.0);
		//pane.getStyleClass().add("icon-blue");
		pane.setLayoutX(0.0);
		pane.setLayoutY(0.0);
		
		CubicCurve curve = new CubicCurve();
		
		curve.setStartX(10.0);
		curve.setStartY(20.0);
		curve.setEndX(54.0);
		curve.setEndY(44.0);
		curve.setControlX1(64.0);
		curve.setControlY1(20.0);
		curve.setControlX2(0.0);
		curve.setControlY2(44.0);
		curve.getStyleClass().add("cubic-icon");
		
		pane.getChildren().add(curve);
		
		//r//oot_pane.
		getChildren().add(pane);
		
	break;
	
	case blue:
		getStyleClass().add("icon-blue");
	break;

	case red:
		getStyleClass().add("icon-red");			
	break;

	case green:
		getStyleClass().add("icon-green");
	break;

	case grey:
		getStyleClass().add("icon-grey");
	break;

	case purple:
		getStyleClass().add("icon-purple");
	break;

	case yellow:
		getStyleClass().add("icon-yellow");
	break;

	case black:
		getStyleClass().add("icon-black");
	break;
	
	default:
	break;
	}
}
 
开发者ID:graffy76,项目名称:java_fx_node_link_demo,代码行数:76,代码来源:DragIcon.java


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