Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code in java please,, here is a copy of my code for the last lab and a screenshot of the quastation please add the animation

code in java please,, here is a copy of my code for the last lab and a screenshot of the quastation please add the animation to it --------------------------------------------------------------------------------------------------------------------------------------------------------------- import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.stage.Stage; public class Lab15 extends Application{ @Override public void start(Stage stage){ Pane pane =new HBox(); ImageView imageView =new ImageView(); Image [] images = new Image[3]; images[0]= new Image("C:/Users/you14/Downloads/canva-photo-editor-8-7.jpg"); images[1]= new Image("C:/Users/you14/Downloads/download.jpeg"); images[2]= new Image("C:/Users/you14/Pictures/Screenshots/Screenshot_20221026_021557.png"); imageView.setFitWidth(350); // set the width of the image imageView.setPreserveRatio(true); // set the height of the image imageView.setImage(images[first]); // set the image to the image view //when you reach the end of the array disable the next button Button next = new Button("Next"); next.setOnAction(e->{ if(first < images.length-1){ first++; imageView.setImage(images[first]); } else{ next.setDisable(true); }}); //when you reach the beginning of the array disable the previous button Button previous = new Button("Previous"); previous.setOnAction(e->{ if(first >0){ first--; imageView.setImage(images[first]); } else{ previous.setDisable(true); }}); Scene scene = new Scene(pane,500,500); // set the size of the scene pane.getChildren().addAll(next,imageView,previous); // add the buttons and image view to the layout stage.setTitle("Lab15"); stage.setScene(scene); stage.show(); } int first=0; public static void main(String[] args){ launch(args); }}------------------------------------------------------------------------------------------------------------------------------- Objectives: In this lab, the following topic will be covered: 1. Animation Task Add to the previous lab a button slideshow that displays an image from an array of images then after two seconds the next image is displayed and so on. When you reach the last image, reverse the direction. When you reach the first image, reverse the direction.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

Identify and describe five different measurement attributes.

Answered: 1 week ago

Question

How will you access that information?

Answered: 1 week ago