Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help needed! JavaFX package mouserollover; import static com.sun.glass.events.WindowEvent.MAXIMIZE; import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.Pane; public class MouseRollover extends Application

Help needed!

JavaFX

package mouserollover;

import static com.sun.glass.events.WindowEvent.MAXIMIZE; import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.Pane;

public class MouseRollover extends Application {

public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { final double SCENE_WIDTH = 500.0; final double SCENE_HEIGHT = 500.0; Image balloonImage = new Image("file:HotAirBalloon.jpg"); Image flowerImage = new Image("file:flower.jpg"); ImageView myImageView = new ImageView(flowerImage); myImageView.setFitWidth(200); myImageView.setPreserveRatio(true); myImageView.setOnMouseEntered(event -> { myImageView = new ImageView(balloonImage); }); myImageView.setOnMouseExited(event -> { myImageView = new ImageView(flowerImage); });

Pane pane = new Pane(myImageView);

Scene scene = new Scene(pane, SCENE_WIDTH, SCENE_HEIGHT); primaryStage.setScene(scene); primaryStage.show(); } }

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_2

Step: 3

blur-text-image_3

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: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions