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, Student Value Edition (11th Edition)
- OO 一陽齊畫風 7. Which statement best describes the quality of line in the depiction of these figures? Oa. Both figures are depicted using only rigid vertical and horizontal lines. b. One of the figures is depicted using only curving lines; the lines in the other are all vertical. c. One of the figures is depicted using very active curving and zigzag lines; the lines in the other figure are calmer and contained. d. The lines in both depictions are smooth and give the sense of stasis or rest. 8. Which description best applies to these artworks? a. Black and white are the only colors used in these artworks. Ob. The figures are depicted against a busy urban setting. c. Both of the figures wear costumes of rich purple and gold. O d. The figures are both rendered against a largely blank background. Icon Key la2earev05h_ch02 Multi.04 XIarrow_forwardTask 1: You will consider the effects of additive noise and the use of DFT to remove this kind of noise. The noisy image has been generated by adding noise in the form of a cosine function. Using frequency domain filtering, devise a procedure for removing the noise and show your results. For comparison purposes, remove the noise in the spatial domain by convolving the noisy image with Average filter (e.g., 7 x 7 and 15 x 15). Compare resulting images of both spatial and frequency domain filtering. Also, you can elaborate on differences in the jupyter notebook as a comment.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_forward
- Please code the instructions to match the image exactly.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_forwardPut the images used too.arrow_forward
- The image of Fig. 8-52(b) contains the ASCII text of fiveplays by Shakespeare. Would it be possible to hide musicamong the zebras instead of text? If so, how would it work andhow much could you hide in this picture? If not, why not?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_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
- Portrait and Landscape arearrow_forwardQuestion 9 Draw a perspective drawing of the following shape, using the vanishing point provided.arrow_forwardBased on the image attached, design C Code [with good comments & output presentation]. - When the inputs do not get enough 20 numbers, the program display not enough numbers.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