本文整理汇总了Java中javafx.scene.shape.CubicCurve.setEndX方法的典型用法代码示例。如果您正苦于以下问题:Java CubicCurve.setEndX方法的具体用法?Java CubicCurve.setEndX怎么用?Java CubicCurve.setEndX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.CubicCurve
的用法示例。
在下文中一共展示了CubicCurve.setEndX方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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
}
示例4: 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;
}
示例5: 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;
}
}