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: Brief Version (11th Global Edition)
- should an image be visible in the two gray boxes when i do my code?arrow_forward3. Smoothing Images -Take an image, add 20% salt and pepper noise, compare the effect of blurring to remove the noise with box filter (average filter), Gaussian filter, and median filter. Which filter gives the best result?arrow_forwardA robotic production system uses a camera to identify the edge of machine parts. It does this to ensure the quality control of the production line. Two things need to be measured accurately: the position of the edge of the piece and the angle of the edge. A small region of the image is shown in Figure 3a.i) From the formula sheet provided select a suitable edge detection method. Justify your choice. ii) Calculate the magnitude of the edge along row 3. Ignore the edge of the image where the edge cannot be calculated. iii) Calculate the angle of the first edge found in row 3. Ignore the edge of the image where the edge cannot be calculated. iv) An alternative method would be to calculate the 2nd order moment of the image by thresholding the image such that all pixels above the threshold 0.5 are 1.0 and all pixels below the threshold are 0.0. Calculate the angle of the object using this method. v) Explain why the results are slightly different. b) Produce a binary image of the data in…arrow_forward
- Computer Science Write a program to find the image gradients of any gray scale image of your choice in python only. • Display the original, the gradient in x direction, the gradient in y direction, and the gradient magnitude images. • Apply a simple threshold to the gradient magnitude image and display the gradient magnitude and the thresholding image. You may use 100 as your threshold value or any other appropriate value.arrow_forwardI was told to do the next assignment in AutoCAD, but I have only one problem.I need to know how to put the words in vertical in the 3rd row. The first image is the assignment, and the second is how far I've gone. Please show me step by step how to put the words in the third row in vertical. It would be better if you use screenshots.arrow_forwardI want a python code to loop through audio files and extract chroma features. The chroma features should be labeled with their 12-tonal variations and should be in a data frame.arrow_forward
- Question 9 Draw a perspective drawing of the following shape, using the vanishing point provided.arrow_forwardI want a Python code to loop through audio files and extract Line spectral frequencies (LSF) and extract the default number of features, get mean and put the features in a data frame.arrow_forwardPortrait and Landscape arearrow_forward
- Subject= Computer Graphics Please give proper Explanation and solution as soon as possible.arrow_forwardHow does one acquire ‘stable’ images from the subcostal windowarrow_forwardDirections: On a separate piece of paper, write a paraphrase of each of the following passages. Try not to look back at the original passage. 4. Matisse is the best painter ever at putting the viewer at the scene. He's the most realistic of all modern artists, if you admit the feel of the breeze as necessary to a landscape and the smell of oranges as essential to a still life. "The Casbah Gate" depicts the well-known gateway Bab el Aassa, which pierces the southern wall of the city near the sultan's palace. With scrubby coats of ivory, aqua, blue, and rose delicately fenced by the liveliest gray outline in art history, Matisse gets the essence of a Tangier afternoon, including the subtle presence of the bowaab, the sentry who sits and surveys those who pass through the gate. From Peter Plagens, "Bright Lights." Newsweek (26 March 1990): 50.arrow_forward
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage