本文整理汇总了Java中javafx.scene.shape.Ellipse.setRadiusY方法的典型用法代码示例。如果您正苦于以下问题:Java Ellipse.setRadiusY方法的具体用法?Java Ellipse.setRadiusY怎么用?Java Ellipse.setRadiusY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.Ellipse
的用法示例。
在下文中一共展示了Ellipse.setRadiusY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
示例2: addLEDs
import javafx.scene.shape.Ellipse; //导入方法依赖的package包/类
private void addLEDs(final Pane pane, final int w, final int h, final boolean horizontal)
{
final int save_bits = numBits;
final boolean save_sq = square_led;
final Color [] save_colorVals = value_colors;
final Shape [] leds = new Shape[save_bits];
for (int i = 0; i < save_bits; i++)
{
final Shape led;
if (save_sq)
{
final Rectangle rect = new Rectangle();
rect.setX(horizontal ? i*w/save_bits : 0);
rect.setY(horizontal ? 0 : i*h/save_bits);
rect.setWidth(horizontal ? w/save_bits : w);
rect.setHeight(horizontal ? h : h/save_bits);
led = rect;
}
else
{
final Ellipse ell = new Ellipse();
final int dh = horizontal ? w/save_bits : w;
final int dv = horizontal ? h : h/save_bits;
ell.setCenterX(horizontal ? dh/2 + i*dh : dh/2);
ell.setCenterY(horizontal ? dv/2 : dv/2 + i*dv);
ell.setRadiusX(dh/2);
ell.setRadiusY(dv/2);
led = ell;
}
led.getStyleClass().add("led");
if (save_colorVals != null && i < save_colorVals.length)
led.setFill( makeGradient(save_colorVals[i]) );
leds[i] = led;
}
this.leds = leds;
pane.getChildren().clear();
pane.getChildren().addAll(leds);
}
示例3: getEllipse
import javafx.scene.shape.Ellipse; //导入方法依赖的package包/类
/** Return an Ellipse of specified properties */
private Ellipse getEllipse(Circle c) {
Ellipse e = new Ellipse();
e.setCenterY(c.getRadius() - c.getRadius() / 3);
e.setRadiusX(c.getRadius() / 4);
e.setRadiusY(c.getRadius() / 3 - 20);
e.setStroke(Color.BLACK);
e.setFill(Color.WHITE);
return e;
}
示例4: draw
import javafx.scene.shape.Ellipse; //导入方法依赖的package包/类
@Override
public void draw(Group g) {
DropShadow ds = new DropShadow();
ds.setOffsetY(3.0);
ds.setColor(Color.color(0.4, 0.4, 0.4));
Ellipse ellipse = new Ellipse();
ellipse.setCenterX(50.0f);
ellipse.setCenterY(50.0f);
ellipse.setRadiusX(50.0f);
ellipse.setRadiusY(25.0f);
ellipse.setFill(Color.RED);
ellipse.setStroke(Color.BLACK);
ellipse.setEffect(ds);
g.getChildren().add(ellipse);
g.addEventHandler(MouseEvent.MOUSE_CLICKED, ev -> {
if (ev.getClickCount() == 2 && MouseButton.PRIMARY == ev.getButton()) {
if (ev.isConsumed())
return;
if (ellipse.getUserData() != null)
return;
JFXColorPicker picker = new JFXColorPicker();
picker.setValue((Color) ellipse.getFill());
picker.valueProperty().addListener(new ChangeListener<Color>() {
@Override
public void changed(ObservableValue<? extends Color> observable, Color oldValue, Color newValue) {
ellipse.setFill(newValue);
}
});
FxUtil.createStageAndShow(" select color ", picker, stage -> {
ellipse.setUserData(new Object());
stage.setAlwaysOnTop(true);
stage.setOnCloseRequest(se -> {
ellipse.setUserData(null);
});
});
ev.consume();
}
});
}
示例5: updateChanges
import javafx.scene.shape.Ellipse; //导入方法依赖的package包/类
@Override
public void updateChanges()
{
if (typeChanged.checkAndClear())
{
createLED();
styleChanged.mark();
dirty_content.mark();
}
super.updateChanges();
if (styleChanged.checkAndClear())
{
final Color color = JFXUtil.convert(model_widget.propForegroundColor().getValue());
label.setTextFill(color);
label.setFont(JFXUtil.convert(model_widget.propFont().getValue()));
final int w = model_widget.propWidth().getValue();
final int h = model_widget.propHeight().getValue();
jfx_node.setPrefSize(w, h);
if (led instanceof Ellipse)
{
final Ellipse ell = (Ellipse) led;
ell.setCenterX(w/2);
ell.setCenterY(h/2);
ell.setRadiusX(w/2);
ell.setRadiusY(h/2);
}
else if (led instanceof Rectangle)
{
final Rectangle rect = (Rectangle) led;
rect.setWidth(w);
rect.setHeight(h);
}
label.setPrefSize(w, h);
}
if (dirty_content.checkAndClear())
{
led.setFill(
// Put highlight in top-left corner, about 0.2 wide,
// relative to actual size of LED
new RadialGradient(0, 0, 0.3, 0.3, 0.4, true, CycleMethod.NO_CYCLE,
new Stop(0, value_color.interpolate(Color.WHITESMOKE, 0.8)),
new Stop(1, value_color)));
label.setText(value_label);
}
}