本文整理汇总了Java中javafx.scene.shape.ArcTo.setY方法的典型用法代码示例。如果您正苦于以下问题:Java ArcTo.setY方法的具体用法?Java ArcTo.setY怎么用?Java ArcTo.setY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.ArcTo
的用法示例。
在下文中一共展示了ArcTo.setY方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawingAreaMouseClicked
import javafx.scene.shape.ArcTo; //导入方法依赖的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);
}
}
示例2: draw
import javafx.scene.shape.ArcTo; //导入方法依赖的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());
}
示例3: addArcTo
import javafx.scene.shape.ArcTo; //导入方法依赖的package包/类
/**
* Adds a circular detour arc to the path, to the given position.
*
* @param x the final x position of the arc
* @param y the final y position of the arc
*/
private void addArcTo(final double x, final double y) {
final ArcTo arcTo = new ArcTo();
arcTo.setRadiusX(DETOUR_RADIUS);
arcTo.setRadiusY(DETOUR_RADIUS);
arcTo.setSweepFlag(sign > 0);
arcTo.setX(GeometryUtils.moveOffPixel(x));
arcTo.setY(GeometryUtils.moveOffPixel(y));
getPathElements().add(arcTo);
}
示例4: start
import javafx.scene.shape.ArcTo; //导入方法依赖的package包/类
@Override
public void start(Stage palco) throws Exception {
StackPane painelEmpilhador = new StackPane();
Rectangle retangulo = new Rectangle(220, 120);
retangulo.setFill(Color.GREEN);
Polygon losango = new Polygon();
losango.getPoints().addAll(new Double[]{
50.0, 50.0,
150.0, 0.0,
250.0, 50.0,
150.0, 100.0,
50.0, 50.0 });
losango.setFill(Color.YELLOW);
Path arco = new Path();
MoveTo moveTo = new MoveTo();
moveTo.setX(0.0);
moveTo.setY(0.0);
ArcTo arcTo = new ArcTo();
arcTo.setX(55.0);
arcTo.setY(0.0);
arcTo.setRadiusX(50.0);
arcTo.setRadiusY(50.0);
arco.getElements().add(moveTo);
arco.getElements().add(arcTo);
arco.setStroke(Color.WHITE);
arco.setRotate(180);
arco.setStrokeWidth(5);
Circle circulo = new Circle(30, Color.BLUE);
painelEmpilhador.getChildren().addAll(retangulo, losango, circulo, arco);
Scene cena = new Scene(painelEmpilhador, 250, 100);
palco.setTitle("Testando StackPane");
palco.setScene(cena);
palco.show();
}
示例5: createArc
import javafx.scene.shape.ArcTo; //导入方法依赖的package包/类
/**
* Creates an {@link ArcTo} with the specified parameters.
*
* Coordinates of the end point of the arc are given in polar form relative
* to the center of the arcs.
*
* @param radius
* The radius of the arc.
* @param center
* The center coordinates of the arc.
* @param angle
* The angle of the end point.
* @param sweep
* The draw direction of the arc.
* @param largeArc
* if true draw an arc larger than 180 degrees.
* @return an ArcTo with the specified parameters.
*/
private ArcTo createArc(final double radius, final Point2D center,
final double angle, final boolean sweep, final boolean largeArc) {
// calculate the end point of the arc
double endX = center.getX() + radius * Math.sin(angle);
double endY = center.getY() - radius * Math.cos(angle);
// create the arc
ArcTo result = new ArcTo();
result.setRadiusX(radius);
result.setRadiusY(radius);
result.setX(endX);
result.setY(endY);
result.setSweepFlag(sweep);
result.setLargeArcFlag(largeArc);
return result;
}
示例6: createOuterCircleSegments
import javafx.scene.shape.ArcTo; //导入方法依赖的package包/类
/**
* computes the circular ring segments specified by segmentCount
* through translation of vector coordinates into local coordinate-space at
* application runtime <br>
* Each segment and its associated symbol will be added to a
* group-node which will be put into an ObservableList of type Group: segments <br>
* @see {@link segments}, {@link getSegments}, {@link setSegments}
*/
private void createOuterCircleSegments()
{
double segmentRadians = 360/segmentCount*Math.PI/180;
for(int i = 2; i <= segmentCount+1; i++)
{
Group g = new Group();
Path p = new Path();
p.setFill(fillColor);
p.setStroke(strokeColor);
p.setFillRule(FillRule.EVEN_ODD);
MoveTo firstPoint = new MoveTo();
firstPoint.setX(centerX + innerRadius*Math.cos(segmentRadians*(i-1)));
firstPoint.setY(centerY + innerRadius*Math.sin(segmentRadians*(i-1)));
p.getElements().add(firstPoint);
LineTo nextLine = new LineTo();
nextLine.setX(centerX + outerRadius*Math.cos(segmentRadians*(i-1)));
nextLine.setY(centerY + outerRadius*Math.sin(segmentRadians*(i-1)));
ArcTo outerArc = new ArcTo();
outerArc.setSweepFlag(true);
outerArc.setAbsolute(true);
outerArc.setX(centerX + outerRadius*Math.cos(2*Math.PI + segmentRadians*i));
outerArc.setY(centerY + outerRadius*Math.sin(2*Math.PI + segmentRadians*i));
outerArc.setRadiusX(outerRadius);
outerArc.setRadiusY(outerRadius);
LineTo line2 = new LineTo();
line2.setX(centerX + innerRadius*Math.cos(segmentRadians*(i)));
line2.setY(centerY + innerRadius*Math.sin(segmentRadians*(i)));
ArcTo innerArc = new ArcTo();
innerArc.setSweepFlag(false);
innerArc.setAbsolute(true);
innerArc.setX(centerX + innerRadius*Math.cos(2*Math.PI + segmentRadians*(i-1)));
innerArc.setY(centerY + innerRadius*Math.sin(2*Math.PI + segmentRadians*(i-1)));
innerArc.setRadiusX(innerRadius);
innerArc.setRadiusY(innerRadius);
MoveTo end = new MoveTo();
end.setX(centerX + innerRadius*Math.cos(segmentRadians*(i)));
end.setY(centerY + innerRadius*Math.sin(segmentRadians*(i)));
p.getElements().add(nextLine);
p.getElements().add(outerArc);
p.getElements().add(line2);
p.getElements().add(innerArc);
p.getElements().add(end);
g.getChildren().add(p);
// temporary: for button layout injection
Rectangle rect = new Rectangle();
rect.setX(centerX-((outerRadius-innerRadius)*0.35) + (innerRadius + (outerRadius - innerRadius)/2)*Math.cos(segmentRadians*(i-.5)));
rect.setY(centerY-((outerRadius-innerRadius)*0.35) + (innerRadius + (outerRadius - innerRadius)/2)*Math.sin(segmentRadians*(i-.5)));
rect.setWidth(((outerRadius-innerRadius)*0.7));
rect.setHeight(((outerRadius-innerRadius)*0.7));
rect.setRotate(Math.toDegrees(segmentRadians*(i-.5)));
rect.setFill(Color.RED);
g.getChildren().add(rect);
segments.add(g);
}
}