Instructions: In the textbook complete 14.3, 14.9, 14.13 and 14.19 There is not a myProgrammingLab assignment for this unit. You must use JavaFX not Swing to implement the graphics. CS 2323 Unit 07...

1 answer below »
Instructions:

In the textbook complete 14.3, 14.9, 14.13 and 14.19


There is not a myProgrammingLab assignment for this unit.


You must use JavaFX not Swing to implement the graphics.


CS 2323 Unit 07
14.3
1 Display Stage
2 Display Cards
1 Documentation


14.9
1 Display Stage
2 Display Fans
1 Documentation


14.13
1 Display Stage
2 Display Pie Chart
1 Documentation


14.19
1 Display Stage
1 Draw Axis and labels
1 Draw Curve
1 Documentation




Instructions: In the textbook complete 14.3, 14.9, 14.13 and 14.19 There is not a myProgrammingLab assignment for this unit. You must use JavaFX not Swing to implement the graphics. CS 2323 Unit 07 14.3 1 Display Stage 2 Display Cards 1 Documentation 14.9 1 Display Stage 2 Display Fans 1 Documentation 14.13 1 Display Stage 2 Display Pie Chart 1 Documentation 14.19 1 Display Stage 1 Draw Axis and labels 1 Draw Curve 1 Documentation
Answered Same DayOct 03, 2021

Answer To: Instructions: In the textbook complete 14.3, 14.9, 14.13 and 14.19 There is not a myProgrammingLab...

Sudipta answered on Oct 06 2021
149 Votes
CODE: Exercise 14.3
import java.util.Random;
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.H
Box;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Card extends Application {
Image images[];
@Override
public void start(Stage primaryStage) {
images = new Image[12];
for (int i = 0; i < images.length; i++) {
images[i] = new Image("file:C:\\Users\\LEO\\CardPhoto\\"
+ (i + 1) + ".png", true);
}
Random random = new Random();
HBox row1 = new HBox();
row1.setAlignment(Pos.CENTER);
int randomIndex = random.nextInt(images.length - 2);
ImageView im1 = new ImageView(images[randomIndex]);
row1.getChildren().add(im1);
randomIndex = random.nextInt(images.length - 2);
ImageView im2 = new ImageView(images[randomIndex]);
row1.getChildren().add(im2);
randomIndex = random.nextInt(images.length - 2);
ImageView im3 = new ImageView(images[randomIndex]);
row1.getChildren().add(im3);
VBox container = new VBox(row1);
Scene scene = new Scene(container, 150, 150);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
OUTPUT:
The image below shows the output of the above code.
NOTE: "file:C:\\Users\\LEO\\CardPhoto\\" change it to the path where the 52 images are downloaded and stored named 1.png 2.png and so on. We use random function to choose random numbers and display the cards at that position. And at the last the stage is displayed.
CODE: Exercise 14.9
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.Pane;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Arc;
import javafx.scene.shape.ArcType;
import javafx.scene.paint.Color;
import javafx.geometry.Insets;
public class FanGrid extends Application {
    @Override
    public void start(Stage stage) {
        
        GridPane gp = new GridPane();
        gp.setPadding(new Insets(10, 10, 10, 10));
        gp.setHgap(10);
        gp.setVgap(10);
        for (int i = 0;...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here