Explanation of Solution
Purpose of the given code:
The purpose of the given code is resizing objects placed inside based on the window size. In the given code a rectangle and circle is placed inside the stack pane, the object gets resized based on the window size.
Given code:
//import the required packages
import javafx.application.Application ;
import javafx.scene.paint.Color ;
import javafx.scene.shape .Circle ;
import javafx.scene.shape.Rectangle ;
import javafx .stage.Stage;
import javafx.scene.Scene;
import javafx .scene.control .Label ;
import javafx.scene.layout.StackPane ;
//define the method ResizableCircleRectangle
public class ResizableCircleRectangle extends Application
{
//Create a circle
private Circle circle= new Circle( 60) ;
//new rectangle gets created
private Rectangle rectangle = new Rectangle( 120 , 120);
// Place clock and label in border pane
private StackPane pane = new StackPane() ;
@Override
// Override the start method in the Application class
public void start(Stage primaryStage)
{
//set the fill color of circle
circle.setFill (Color.GRAY) ;
//set the fill color of rectangle
rectangle.setFill (Color.WHITE);
//set the stroke color
rectangle.setStroke(Color.BLACK);
//add all to the pane
pane.getChildren() .addAll (rectangle, circle);
//new scene gets created and placed on the stage
Scene scene = new Scene (pane , 140, 140) ;
//set the title of the stage
primaryStage.setTitle( "ResizableCircleRectangle" );
//the scene gets placed on the stage
primaryStage .setScene(scene);
//the stage gets displayed
primaryStage.show();
//set the height property
pane.widthProperty().addListener(ov ->resize()) ;
//set the width property
pane.heightProperty() .addListener(ov -> resize());
}
//define the method resize
private void resize()
{
//define length of the pane
double length= Math...
Want to see the full answer?
Check out a sample textbook solutionChapter 15 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
- Can someone construct the Gnatt Chart for this screenshot?arrow_forwardPlease refer to image and show on paper to see it easier!arrow_forwardyou need to write a code/program to do image filtration or convolution of 2 noise filters. Please submit a report on the assignment.1.0 Introduction -Please state a simple objective - what you want to study based on the choice of the filter2.0 Method3.0 Discussionarrow_forward
- Can I get help with doing problem A and E in the image. With details on how to do it. Thank you.arrow_forwardIn image 1, for the visualize the result with + and - Can you just use another simple way to do it ? Like use for loop and simple calculation to do it? because I didnt learn repeat() yet. Thank you Image two is the expected output.arrow_forwardWhy do we speak of a reduction in the output's visual quality when rasterizing?arrow_forward
- Please write python codes to enhance an image by using gamma transformation, after showing your original image and the enhanced image, please save the enhanced image in your codes. Note: please compare the effects with different gamma values.arrow_forwardCreate a list of frames to split screen according to the following figure:arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education