Question
i'm having a problem on javafx i need to store the shapes in array place them randomly using java.util.ramdom but I don't know how here
i'm having a problem on javafx
i need to store the shapes in array place them randomly using java.util.ramdom but I don't know how
here is the code
package javafxapplication1;
import java.util.Random;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Ellipse;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Line;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class ShowShapes extends Application {
@Override
public void start(Stage primaryStage) {
GridPane pane = new GridPane();
Random n = new Random();
Text text = new Text("WELCOME JAVAFX ");
text.setStroke(Color.RED);
Line line = new Line(0, 0, 100, 100);
text.setStroke(Color.YELLOWGREEN);
Circle c = new Circle(50);
c.setStroke(Color.BLACK);
c.setFill(Color.RED);
Rectangle r = new Rectangle(100, 100);
r.setStroke(Color.BLACK);
r.setFill(Color.RED);
Circle c2 = new Circle(50);
c2.setStroke(Color.GREEN);
c2.setFill(Color.BLUE);
Ellipse e = new Ellipse(50, 25);
e.setStroke(Color.YELLOW);
e.setFill(Color.ORANGE);
pane.add(text, 0, 0);
pane.add(line, 1, 0);
pane.add(c, 2, 0);
pane.add(r, 0, 1);
pane.add(c2, 1, 1);
pane.add(e, 2, 1);
Scene scene = new Scene(pane, 305, 200);
primaryStage.setTitle("Show Shapes");
primaryStage.setScene(scene);
primaryStage.show();
}
}
Step by Step Solution
3.42 Rating (149 Votes )
There are 3 Steps involved in it
Step: 1
Code as per the instruction provided please let me know if you need any more help is required Explan...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Document Format ( 2 attachments)
608c00a37e473_208171.pdf
180 KBs PDF File
608c00a37e473_208171.docx
120 KBs Word File
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started