i'm having a problem on javafx i need to store the shapes in array place them randomly
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 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();
}
}
Systems analysis and design
ISBN: 978-0136089162
8th Edition
Authors: kenneth e. kendall, julie e. kendall