Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Document Format ( 2 attachments)

PDF file Icon
608c00a37e473_208171.pdf

180 KBs PDF File

Word file Icon
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

Recommended Textbook for

Systems analysis and design

Authors: kenneth e. kendall, julie e. kendall

8th Edition

135094909, 013608916X, 9780135094907, 978-0136089162

More Books

Students also viewed these Computer Network questions

Question

What symbols are used to draw E-R diagrams?

Answered: 1 week ago

Question

Explain the action potential.

Answered: 1 week ago

Question

Recall the role of various endocrine glands.

Answered: 1 week ago

Question

Identify the parts of a neuron and describe the function of each.

Answered: 1 week ago