本文整理汇总了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
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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
};
}
示例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;
}
示例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);
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}