本文整理汇总了Java中javafx.scene.shape.Circle.setCenterX方法的典型用法代码示例。如果您正苦于以下问题:Java Circle.setCenterX方法的具体用法?Java Circle.setCenterX怎么用?Java Circle.setCenterX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Circle
的用法示例。
在下文中一共展示了Circle.setCenterX方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFragments
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
private List<Circle> buildFragments(BubbleType bubbleType) {
List<Circle> fragments = new ArrayList<>(nbFragments);
for (int i = 0; i < nbFragments; i++) {
Circle fragment = new Circle();
fragment.setOpacity(1);
fragment.setRadius(20);
fragment.setVisible(true);
fragment.setCenterX(-100);
fragment.setCenterY(-100);
if (bubbleType == BubbleType.COLOR) {
fragment.setFill(new Color(Math.random(), Math.random(), Math.random(), 1));
} else {
fragment.setFill(new ImagePattern(newPhoto(), 0, 0, 1, 1, true));
}
fragments.add(fragment);
}
return fragments;
}
示例2: moveCircle
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
private void moveCircle(Circle C) {
double centerX = (scene.getWidth() - maxRadius) * Math.random() + maxRadius;
double centerY = scene.getHeight();
C.setCenterX(centerX);
//C.setTranslateY((scene.getHeight() - maxRadius) * Math.random() + maxRadius);
C.setCenterY(centerY);
double radius = (maxRadius - minRadius) * Math.random() + minRadius;
C.setFill(new Color(Math.random(), Math.random(), Math.random(), 1));
C.setRadius(radius);
Timeline timeline = new Timeline();
double timelength = ((maxTimeLength - minTimeLength) * Math.random() + minTimeLength) * 1000;
timeline.getKeyFrames().add(new KeyFrame(new Duration(timelength), new KeyValue(C.centerYProperty(), 0 - maxRadius, Interpolator.EASE_IN)));
/* SequentialTransition sequence = new SequentialTransition();
for(int i = 0; i < 10; i++) {
sequence.getChildren().add(new KeyFrame(new Duration(timelength / 10), new KeyValue(C.centerXProperty(), centerX - 100)));
sequence.getChildren().add(new KeyFrame(new Duration(timelength / 10), new KeyValue(C.centerXProperty(), centerX + 100)));
}*/
timeline.play();
timeline.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
//moveCircle(C);
newCircle();
}
});
}
示例3: configureBackground
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
private void configureBackground() {
ImageView imageView = new ImageView();
Image image = loadImage();
imageView.setImage(image);
Circle circle1 = new Circle();
circle1.setCenterX(140);
circle1.setCenterY(140);
circle1.setRadius(120);
circle1.setFill(Color.TRANSPARENT);
circle1.setStroke(Color.web("#0A0A0A"));
circle1.setStrokeWidth(0.3);
Circle circle2 = new Circle();
circle2.setCenterX(140);
circle2.setCenterY(140);
circle2.setRadius(118);
circle2.setFill(Color.TRANSPARENT);
circle2.setStroke(Color.web("#0A0A0A"));
circle2.setStrokeWidth(0.3);
Circle circle3 = new Circle();
circle3.setCenterX(140);
circle3.setCenterY(140);
circle3.setRadius(140);
circle3.setFill(Color.TRANSPARENT);
circle3.setStroke(Color.web("#818a89"));
circle3.setStrokeWidth(1);
Ellipse ellipse = new Ellipse(140, 95, 180, 95);
Circle ellipseClip = new Circle(140, 140, 140);
ellipse.setFill(Color.web("#535450"));
ellipse.setStrokeWidth(0);
GaussianBlur ellipseEffect = new GaussianBlur();
ellipseEffect.setRadius(10);
ellipse.setEffect(ellipseEffect);
ellipse.setOpacity(0.1);
ellipse.setClip(ellipseClip);
background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse);
}
示例4: start
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
if (primaryStage == null) {
return;
}
//Create Circles
Circle circleRed = new Circle(50.0, Color.RED);
circleRed.setCursor(Cursor.HAND);
circleRed.setOnMousePressed(circleOnMousePressedEventHandler);
circleRed.setOnMouseDragged(circleOnMouseDraggedEventHandler);
Circle circleGreen = new Circle(50.0, Color.GREEN);
circleGreen.setCursor(Cursor.MOVE);
circleGreen.setCenterX(150);
circleGreen.setCenterY(150);
circleGreen.setOnMousePressed(circleOnMousePressedEventHandler);
circleGreen.setOnMouseDragged(circleOnMouseDraggedEventHandler);
Circle circleBlue = new Circle(50.0, Color.BLUE);
circleBlue.setCursor(Cursor.CROSSHAIR);
circleBlue.setTranslateX(300);
circleBlue.setTranslateY(100);
circleBlue.setOnMousePressed(circleOnMousePressedEventHandler);
circleBlue.setOnMouseDragged(circleOnMouseDraggedEventHandler);
Group root = new Group();
root.getChildren().addAll(circleRed, circleGreen, circleBlue);
primaryStage.setResizable(false);
primaryStage.setScene(new Scene(root, 400,350));
primaryStage.setTitle("java-buddy");
primaryStage.show();
}
示例5: InteractiveWayPointDot
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
public InteractiveWayPointDot(int x, int y) throws FlightZoneException{
wayPointDot = new Circle();
wayPointDot.setRadius(radius);;
wayPointDot.setCenterX(x);
wayPointDot.setCenterY(y);
wayPointDot.setFill(Color.LIGHTSTEELBLUE);
wayPointDot.setStroke(Color.BLACK);
wayPointDot.setStrokeWidth(1);
longitude = DecimalDegreesToXYConverter.getInstance().ConvertXCoordsToDecimalDegrees(x);
latitude = DecimalDegreesToXYConverter.getInstance().ConvertYCoordsToDecimalDegrees(y);
this.x = x;
this.y = y;
}
示例6: DroneBase
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
/**
* Constructor
* @param baseName Unique basename
* @param latitude of base
* @param longitude of base
* @param altitude of base
* @throws FlightZoneException
*/
public DroneBase(String baseName, long lat, long lon, int alt, int radius) throws FlightZoneException{
basePosition = new Coordinates(lat,lon,alt);
coordTransform = DecimalDegreesToXYConverter.getInstance();
this.baseName = baseName;
circle = new Circle();
circle.setRadius(radius);
Point point = coordTransform.getPoint(lat, lon);
circle.setCenterX(point.getX()+radius*.6);
circle.setCenterY(point.getY()+radius*.6);
circle.setFill(Color.LIGHTYELLOW);
circle.setStroke(Color.BLACK);
circle.setStrokeWidth(1);
}
示例7: createCloseIcon
import javafx.scene.shape.Circle; //导入方法依赖的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;
}
示例8: drawPoint
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
private void drawPoint(ChartValue value) {
Color fillColor = Color.TRANSPARENT;
Circle circle = new Circle();
CustomAxis yAxis;
double x = value.getX();
double y = value.getY();
int axisNum = value.getAxis();
if (axisNum == 0) {
yAxis = y1Axis;
circle.setStroke(strokeColor);
} else {
yAxis = y2Axis;
circle.setStroke(strokeColor2);
}
double x_pos = getPosInXAxis(x);
double y_pos = getPositionInYAxis(yAxis, yLeftAxisLine, y);
if (isValueInBounds(x_pos, y_pos)) {
valueComponents.add(circle);
circle.setFill(fillColor);
circle.setRadius(value.getStrokeSize());
circle.setCenterX(x_pos);
circle.setCenterY(y_pos);
getChildren().add(circle);
}
}
示例9: moveCircle
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
private void moveCircle(Circle circle) {
javafx.geometry.Dimension2D dimension2D = gameContext.getGamePanelDimensionProvider().getDimension2D();
log.info("dimension2D = {}", dimension2D);
double centerX = (dimension2D.getWidth() - maxRadius) * Math.random() + maxRadius;
double centerY = dimension2D.getHeight();
circle.setCenterX(centerX);
// circle.setTranslateY((scene.getHeight() - maxRadius) * Math.random() + maxRadius);
circle.setCenterY(centerY);
double timelength = ((maxTimeLength - minTimeLength) * Math.random() + minTimeLength) * 1000;
Timeline timeline = new Timeline();
timeline.getKeyFrames().add(new KeyFrame(new Duration(timelength),
new KeyValue(circle.centerYProperty(), 0 - maxRadius, Interpolator.EASE_IN)));
timeline.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
// moveCircle(circle);
newCircle();
}
});
timeline.play();
}
示例10: updateClipping
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
private void updateClipping() {
if (movieView.isUseClipping()) {
Circle circle = new Circle();
double size = 30;
circle.setRadius(size);
circle.setCenterX(size);
circle.setCenterY(size);
directorImage.setClip(circle);
} else {
directorImage.setClip(null);
}
}
示例11: toggleDeclaration
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
public void toggleDeclaration(final MouseEvent mouseEvent) {
final Circle circle = new Circle(0);
circle.setCenterX(component.get().getWidth() - (toggleDeclarationButton.getWidth() - mouseEvent.getX()));
circle.setCenterY(-1 * mouseEvent.getY());
final ObjectProperty<Node> clip = new SimpleObjectProperty<>(circle);
declaration.clipProperty().bind(clip);
final Transition rippleEffect = new Transition() {
private final double maxRadius = Math.sqrt(Math.pow(getComponent().getWidth(), 2) + Math.pow(getComponent().getHeight(), 2));
{
setCycleDuration(Duration.millis(500));
}
protected void interpolate(final double fraction) {
if (getComponent().isDeclarationOpen()) {
circle.setRadius(fraction * maxRadius);
} else {
circle.setRadius(maxRadius - fraction * maxRadius);
}
clip.set(circle);
}
};
final Interpolator interpolator = Interpolator.SPLINE(0.785, 0.135, 0.15, 0.86);
rippleEffect.setInterpolator(interpolator);
rippleEffect.play();
getComponent().declarationOpenProperty().set(!getComponent().isDeclarationOpen());
}
示例12: animiereBall
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
public Pane animiereBall() {
animationPane = new Pane();
animationPane.setPrefSize(pb, ph);
circle = new Circle(x, y, r, color);
Timeline timeline = new Timeline();
timeline.setCycleCount(Timeline.INDEFINITE);
KeyFrame moveBall = new KeyFrame(Duration.millis(intervall), new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
if (((circle.getCenterX() + dx < r) && (dx < 0)) || ((circle.getCenterX() + dx > animationPane.getWidth() - r) && (dx > 0))) {
dx = -dx;
}
circle.setCenterX(circle.getCenterX() + dx);
if (((circle.getCenterY() + dy < r) && (dy < 0)) || ((circle.getCenterY() + dy > animationPane.getHeight() - r) && (dy > 0))) {
dy = -dy;
}
circle.setCenterY(circle.getCenterY() + dy);
}
});
timeline.getKeyFrames().add(moveBall);
timeline.play();
HBox hBox = this.navigiereAnimation(timeline);
animationPane.getChildren().addAll(circle, hBox);
return animationPane;
}
示例13: createIndicator
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
private Circle createIndicator(Double toX, Double toY, Double radius) {
indicator = new Circle();
indicator.setRadius(radius);
indicator.setCenterX(toX);
indicator.setCenterY(toY);
return indicator;
}
示例14: drawValue
import javafx.scene.shape.Circle; //导入方法依赖的package包/类
private void drawValue(ChartValue radObject, Circle circle, Text text) {
String category = radObject.getCategory();
double value = radObject.getValue();
int index = -1;
double angleOfPoints = 360.0f / categoriesName.length;
double angle = -90;
for (int i = 0; i < categoriesName.length; i++) {
if (categoriesName[i].equals(category)) {
index = i;
break;
}
angle += angleOfPoints;
}
if (index == -1 || linesOfPoints == null || linesOfPoints.length == 0) {
return;
}
if (value >= minValue && value <= maxValue) {
double pos = value / maxValue;
double startX = linesOfPoints[index].getStartX();
double startY = linesOfPoints[index].getStartY();
double rad = angle * Math.PI / 180.0f;
double x = startX + (radius * pos) * Math.cos(rad);
double y = startY + (radius * pos) * Math.sin(rad);
radObject.setX(x);
radObject.setY(y);
circle.setCenterX(x);
circle.setCenterY(y);
circle.setRadius(POINTS_RADIUS);
circle.setFill(Color.RED);
text.setX(x + 5);
text.setY(y);
text.setText(String.valueOf(value));
text.setFont(Font.font(15));
getChildren().addAll(circle, text);
}
}