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


Java Ellipse类代码示例

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


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

示例1: EllipseSample

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
public EllipseSample() {
    super(180,90);
    // Simple red filled ellipse
    Ellipse ellipse1 = new Ellipse(45,45,30,45);
    ellipse1.setFill(Color.RED);
    // Blue stroked ellipse
    Ellipse ellipse2 = new Ellipse(135,45,30,45);
    ellipse2.setStroke(Color.DODGERBLUE);
    ellipse2.setFill(null);
    // Create a group to show all the ellipses);
    getChildren().add(new Group(ellipse1,ellipse2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Ellipse 1 Fill", ellipse1.fillProperty()),
            new SimplePropertySheet.PropDesc("Ellipse 1 Width", ellipse1.radiusXProperty(), 10d, 40d),
            new SimplePropertySheet.PropDesc("Ellipse 1 Height", ellipse1.radiusYProperty(), 10d, 45d),
            new SimplePropertySheet.PropDesc("Ellipse 2 Stroke", ellipse2.strokeProperty()),
            new SimplePropertySheet.PropDesc("Ellipse 2 Stroke Width", ellipse2.strokeWidthProperty(), 1d, 5d),
            new SimplePropertySheet.PropDesc("Ellipse 2 Width", ellipse2.radiusXProperty(), 10d, 40d),
            new SimplePropertySheet.PropDesc("Ellipse 2 Height", ellipse2.radiusYProperty(), 10d, 45d)
    );
    // END REMOVE ME
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:24,代码来源:EllipseSample.java

示例2: circle

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
/**
 * 添加一个椭圆
 *
 * @param dragBox
 * @param strokeWidth
 * @param rotate
 * @param fill
 * @param stroke
 */
private void circle(DragBox dragBox, double strokeWidth, double rotate, Color fill, Color stroke) {
    dragBox.setContentNode(new Ellipse(), (node, root) -> {
        ((Ellipse) node).centerXProperty().bind(root.widthProperty().divide(2));
        ((Ellipse) node).centerYProperty().bind(root.heightProperty().divide(2));
        ((Ellipse) node).radiusXProperty().bind(root.widthProperty().divide(2).subtract(10));
        ((Ellipse) node).radiusYProperty().bind(root.heightProperty().divide(2).subtract(10));
        ((Ellipse) node).setSmooth(true);

        root.setLineWidth(strokeWidth);
        root.setNodeRotate(rotate);
        root.setColor(fill);
        root.setLineColor(stroke);
    });
    mainPane.getChildren()
            .add(dragBox);
    mainPane.setChooseListener(dragBox);

    mainPane.requestFocus();
}
 
开发者ID:xfangfang,项目名称:PhotoScript,代码行数:29,代码来源:Controller.java

示例3: findSourceTarget

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
@Before
public void findSourceTarget() {
    from = Lookups.byID(scene, ID_RECTANGLE, Node.class);
    fromPoint = from.getClickPoint();

    toEllipse = Lookups.byID(scene, ID_ELLIPSE, Node.class);
    toEllipsePoint = toEllipse.getClickPoint();
    toEllipsePoint.x = (int) (toEllipsePoint.x
            - ((Ellipse) toEllipse.getControl()).getRadiusX() + 2);

    toCircle = Lookups.byID(scene, ID_CIRCLEOVERELLIPSE, Node.class);
    toCirclePoint = toCircle.getClickPoint();

    toParentNode = Lookups.byID(scene, ID_VB, Node.class);
    toParentPoint = toParentNode.getClickPoint();

    toParentPoint.x = (int) (toParentPoint.x
            - ((Pane) toParentNode.getControl()).getWidth() / 2 + 3);
    toParentPoint.y = (int) (toParentPoint.y
            - ((Pane) toParentNode.getControl()).getHeight() / 2 + 3);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:ExtendedDragTest.java

示例4: getGraphSegments

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
/**
 * Returns a group containing all GraphSegments on the segment coordinates.
 */
private Group getGraphSegments() {
	double maxY = dbm.getDbReader().getMaxYCoord();
	double ellipseHeigth = 30*maxY/1050;
	System.out.println("MAX Y: " + maxY);
	
	Group res = new Group();
	Iterator<Integer> iterator = segmentIds.iterator();
	while (iterator.hasNext()) {
		int segmentId = iterator.next();
		Group graphSegment = new Group();
		Ellipse ellipse = createEllipse(segmentId,ellipseHeigth);
		graphSegment.getChildren().add(ellipse);
		graphSegment.getChildren().add(visualizeDnaContent(segmentId));
		graphSegment.addEventFilter(MouseEvent.MOUSE_CLICKED, 
				new NodeSelectHandler(segmentId, selectedContent, dbm));
		res.getChildren().add(graphSegment);
	}
	return res;
}
 
开发者ID:ProgrammingLife2016,项目名称:PL3-2016,代码行数:23,代码来源:GraphView.java

示例5: createEllipseStimulus

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
/**
 * Create stimulus in ellipse shape.
 * @param locationX
 * @param locationY
 * @param sizeXY
 * @return Ellipse stimulus.
 */
private Ellipse createEllipseStimulus(double locationX, double locationY, double[] sizeXY) {

    /* Get horizontal and vertical radius of the ellipse */
    double radiusX = sizeXY[0] / 2;
    double radiusY = sizeXY[1] / 2;

    /* Get ellipse color */
    double hue = settings.getLuminanceScaleForStimuli().getHue();
    double saturation = settings.getLuminanceScaleForStimuli().getSaturation() / 100;
    double brightness = settings.getStimuliMaxBrightness() / 100;
    Color color = Color.hsb(hue, saturation, brightness);

    /* Create ellipse */
    Ellipse ellipse = new Ellipse(locationX, locationY, radiusX, radiusY);
    ellipse.setFill(color);
    ellipse.setStroke(color);

    return ellipse;
}
 
开发者ID:piotrdzwiniel,项目名称:Specvis,代码行数:27,代码来源:ProcedureBasicFixMonitorFixPointChange.java

示例6: setDisplayVals

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
public void setDisplayVals(int displayWidth, int displayHeight, int feedWidth, int feedHeight) {

		final double scaleX = (double) displayWidth / (double) feedWidth;
		final double scaleY = (double) displayHeight / (double) feedHeight;

		double scaledX, scaledY;
		if (displayX.isPresent()) {
			scaledX = displayX.get() * scaleX;
			scaledY = displayY.get() * scaleY;
		}
		else {
			scaledX = super.getX() * scaleX;
			scaledY = super.getY() * scaleY;
		}

		if (logger.isTraceEnabled()) {
			logger.trace("setTranslation {} {} - {} {} to {} {}", scaleX, scaleY, super.getX(), super.getY(), scaledX, scaledY);
		}

		marker = new Ellipse(scaledX, scaledY, marker.radiusXProperty().get(), marker.radiusYProperty().get());
		marker.setFill(colorMap.get(color));

		displayX = Optional.of(scaledX);
		displayY = Optional.of(scaledY);
		
	}
 
开发者ID:phrack,项目名称:ShootOFF,代码行数:27,代码来源:DisplayShot.java

示例7: Draw

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
@Override
public void Draw(Pane canvas)
{
	double outerDiamX = canvas.getWidth() * (GetDoubleAttribute("Width") / MaximumX);
	double outerDiamY = GetDoubleAttribute("Height") == 0
		? outerDiamX
		: canvas.getHeight() * (GetDoubleAttribute("Height") / MaximumY);

	double proportion = GetDoubleAttribute("Size") / MaximumX;
	double innerDiamX = outerDiamX * proportion;
	double innerDiamY = outerDiamY * proportion;

	double locX = (canvas.getWidth() * (GetDoubleAttribute("X") / MaximumX));
	double locY = (canvas.getHeight() * (GetDoubleAttribute("Y") / MaximumY));

	Ellipse outer = new Ellipse(locX, locY, outerDiamX / 2, outerDiamY / 2);
	Ellipse inner = new Ellipse(locX, locY, innerDiamX / 2, innerDiamY / 2);
	Shape ring = Path.subtract(outer, inner);
	ring.setFill(GetColorAttribute("Color"));
	canvas.getChildren().add(ring);
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:22,代码来源:OverlayRing.java

示例8: Thumbnail

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
@Override
protected Shape[] Thumbnail()
{
	Rectangle border = new Rectangle(25, 30, new Color(1, 1, 0, 0));
	border.setStrokeWidth(3);
	border.setLayoutX(2.5);
	
	Rectangle square = new Rectangle(8, 8);
	square.setLayoutX(7);
	square.setLayoutY(5);
	
	Ellipse circle = new Ellipse(19, 15, 4, 4);
	Polygon triangle = new Polygon(8, 25, 12, 17, 16, 25);
	
	return new Shape[]
	{
		border,
		square,
		circle,
		triangle
	};
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:23,代码来源:OverlayImage.java

示例9: Thumbnail

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
@Override
protected Shape[] Thumbnail()
{
	final int count = 7;
	final int radius = 10;
	final double interval = 2 * Math.PI / count;
	Shape[] shapes = new Shape[count];

	for (int i = 0; i < count; i++)
	{
		double left = Math.cos(i * interval) * radius + 15;
		double top = Math.sin(i * interval) * radius + 15;
		shapes[i] = new Ellipse(left, top, 2.5, 2.5);
	}

	return shapes;
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:18,代码来源:OverlayRepeaterRadial.java

示例10: encloseLabelWithOval

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
private Group encloseLabelWithOval(DrawingEntity entity, Label label) {
    Ellipse ellipse = new Ellipse();
    ellipse.getStyleClass().add("outline");
    ellipse.setFill(entity.getColor());

    ellipse.setCenterX(0);
    ellipse.setCenterY(0);

    int insets = 5;

    label.boundsInLocalProperty().addListener((observable, oldValue, newValue) -> {
        double halfWidth = newValue.getWidth() / 2;
        double halfHeight = newValue.getHeight() / 2;
        label.setLayoutX(-halfWidth);
        label.setLayoutY(-halfHeight);
        // Calculate the relevant radii of the ellipse while maintaining
        // aspect ratio.
        // Thanks: http://stackoverflow.com/questions/433371/ellipse-bounding-a-rectangle
        ellipse.setRadiusX((halfWidth + insets) * SQRT2);
        ellipse.setRadiusY((halfHeight + insets) * SQRT2);
    });

    return new Group(ellipse, label);
}
 
开发者ID:fuzzyBSc,项目名称:systemdesign,代码行数:25,代码来源:FXMLDrawingNode.java

示例11: start

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws IOException {
	Group root = new Group();
	// describes the window itself: name, size
	primaryStage.setTitle(" Aufgabe 10 by John Malc ");
	primaryStage.setScene(new Scene(root));
	// say: center on screen, user can resize, and it will in general exists
	primaryStage.centerOnScreen();
	primaryStage.setResizable(true);
	primaryStage.show();

	// Ellipse alone
	Ellipse a = new Ellipse();
	a.setFill(Color.RED);
	a.setCenterX(205);
	a.setCenterY(150);
	a.setRadiusX(80);
	a.setRadiusY(30);

	// shows Ellipse and it will add it to the group
	root.getChildren().add(new Group(a));
}
 
开发者ID:dmpe,项目名称:JavaFX,代码行数:23,代码来源:Main.java

示例12: configureBackground

import javafx.scene.shape.Ellipse; //导入依赖的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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:StopWatch.java

示例13: createPieceTab

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
private Shape createPieceTab(double eclipseCenterX, double eclipseCenterY, double eclipseRadiusX, double eclipseRadiusY,
                             double rectangleX, double rectangleY, double rectangleWidth, double rectangleHeight,
                             double circle1CenterX, double circle1CenterY, double circle1Radius,
                             double circle2CenterX, double circle2CenterY, double circle2Radius) {
    Ellipse e = new Ellipse(eclipseCenterX, eclipseCenterY, eclipseRadiusX, eclipseRadiusY);
    Rectangle r = new Rectangle(rectangleX, rectangleY, rectangleWidth, rectangleHeight);
    Shape tab = Shape.union(e, r);
    Circle c1 = new Circle(circle1CenterX, circle1CenterY, circle1Radius);
    tab = Shape.subtract(tab, c1);
    Circle c2 = new Circle(circle2CenterX, circle2CenterY, circle2Radius);
    tab = Shape.subtract(tab, c2);
    return tab;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:PuzzlePieces.java

示例14: createIconContent

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
public static Node createIconContent() {
    Ellipse ellipse = new Ellipse(57,57, 20,40);
    ellipse.setStroke(Color.web("#b9c0c5"));
    ellipse.setStrokeWidth(5);
    ellipse.getStrokeDashArray().addAll(15d,15d);
    ellipse.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));
    ellipse.setEffect(effect);
    return ellipse;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:15,代码来源:EllipseSample.java

示例15: EllipseNode

import javafx.scene.shape.Ellipse; //导入依赖的package包/类
private EllipseNode(Ellipse ellipse) {
    super(ellipse);
    this.ellipse = ellipse;
    centerX = PropertyTimelineHolder.empty();
    centerY = PropertyTimelineHolder.empty();
    radiusX = PropertyTimelineHolder.empty();
    radiusY = PropertyTimelineHolder.empty();
}
 
开发者ID:aNNiMON,项目名称:HotaruFX,代码行数:9,代码来源:EllipseNode.java


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