#Resizing issue..

1 messages ยท Page 1 of 1 (latest)

royal zincBOT
#

<@&987246487241105418> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question ๐Ÿค–. Maybe it helps! In any case, a human is on the way ๐Ÿ‘. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
Can help me about it? I want to resize ellipse with respect to window size

Sure! In JavaFX, you can achieve this by binding the ellipse's radius properties to the width and height of the parent container. Here's an example code snippet to demonstrate this:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Ellipse;
import javafx.stage.Stage;

public class ResizableEllipse extends Application {

    @Override
    public void start(Stage primaryStage) {
        Pane root = new Pane();
        
        Ellipse ellipse = new Ellipse();
        ellipse.centerXProperty().bind(root.widthProperty().divide(2));
        ellipse.centerYProperty().bind(root.heightProperty().divide(2));
        ellipse.radiusXProperty().bind(root.widthProperty().multiply(0.4));
        ellipse.radiusYProperty().bind(root.heightProperty().multiply(0.4));
        ellipse.setFill(Color.BLUE);
        
        root.getChildren().add(ellipse);
        
        Scene scene = new Scene(root, 400, 400);
        
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

In this code, we create an Ellipse and bind its properties (centerX, centerY, radiusX, radiusY) to the width and height of the parent Pane container. This ensures that the ellipse resizes proportionally with respect to the window size.

You can customize the resizing behavior by adjusting the multiplier values in the bind method calls for radiusX and radiusY.

Hope this helps! Let me know if you have any more questions.

pure fable
#

What is purpose to multiply with 0.4 ?

pure fable
#

@daring dust if you are free, can you take a look?

#

Ellipse must resize too like in the video