changes needed is at the end of the code
//************************************************************************
// Snowman.java Author: Lewis/Loftus
//
// Demonstrates the translation of a set of shapes.
//************************************************************************
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.*;
public class Snowman extends Application
{
//--------------------------------------------------------------------
// Presents a snowman scene.
//--------------------------------------------------------------------
public void start(Stage primaryStage)
{
Ellipse base = new Ellipse(80, 210, 80, 60);
base.setFill(Color.WHITE);
Ellipse middle = new Ellipse(80, 130, 50, 40);
middle.setFill(Color.WHITE);
Circle head = new Circle(80, 70, 30);
head.setFill(Color.WHITE);
Circle rightEye = new Circle(70, 60, 5);
Circle leftEye = new Circle(90, 60, 5);
Line mouth = new Line(70, 80, 90, 80);
Circle topButton = new Circle(80, 120, 6);
topButton.setFill(Color.RED);
Circle bottomButton = new Circle(80, 140, 6);
bottomButton.setFill(Color.RED);
Line leftArm = new Line(110, 130, 160, 130);
leftArm.setStrokeWidth(3);
Line rightArm = new Line(50, 130, 0, 100);
rightArm.setStrokeWidth(3);
Rectangle stovepipe = new Rectangle(60, 0, 40, 50);
Rectangle brim = new Rectangle(50, 45, 60, 5);
Group hat = new Group(stovepipe, brim);
hat.setTranslateX(10);
hat.setRotate(15);
Group snowman = new Group(base, middle, head, leftEye, rightEye,
mouth, topButton, bottomButton, leftArm, rightArm, hat);
snowman.setTranslateX(170);
snowman.setTranslateY(50);
Circle sun = new Circle(50, 50, 30);
sun.setFill(Color.GOLD);
Rectangle ground = new Rectangle(0, 250, 500, 100);
ground.setFill(Color.STEELBLUE);
Group root = new Group(ground, sun, snowman);
Scene scene = new Scene(root, 500, 350, Color.LIGHTBLUE);
primaryStage.setTitle("Snowman");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args)
{
launch(args);
}
}
____________________________________________________
above is the code and i need to do some changes:
a) Add a third red button to the upper
torso
b) Give the snowman a mouth instead of of the line
he has now (you will need to use the JavaFX Ellipse class to create
the smile)
c) Move the sun to the upper-right corner of the
picture
d) Display your name in the upper-left corner of
the picture
e) Shift the snowman 20 pixels to the right
/* Revise the Snowman application in the following ways: * Add a third button. * Move the sun to the upper-right side of the picture. * Display your name in the upper-left corner of the picture. * Shift the entire snowman 40 pixels to the right. */ //Project 3.10 import javafx.stage.Stage; import javafx.scene.*; import javafx.scene.paint.Color; import javafx.application.Application; import javafx.scene.control.TextField; import javafx.scene.layout.Pane; import javafx.scene.text.Text; import javafx.scene.shape.*; public class Snowman extends Application { public void start(Stage primaryStage) { Text text= new Text(10,10,"YOUR NAME"); Ellipse base = new Ellipse(80, 210,80,60); base.setFill(Color.WHITE); Ellipse middle = new Ellipse(80,130,50,40); middle.setFill(Color.WHITE); Circle head = new Circle(80,70,30); head.setFill(Color.WHITE); Circle rightEye = new Circle(70, 60, 5); Circle leftEye = new Circle(90,60,5); Line mouth = new Line(70, 80, 90, 80); Circle topButton = new Circle(80,120,6); topButton.setFill(Color.RED); Circle middleButton = new Circle(80,140,6); middleButton.setFill(Color.RED); Circle bottomButton= new Circle (80,160,6); bottomButton.setFill(Color.RED); Line leftArm = new Line(110,130,160,130); leftArm.setStrokeWidth(3); Line rightArm = new Line(50,130,0,100); rightArm.setStrokeWidth(3); Rectangle stovepipe = new Rectangle(60,0,40,50); Rectangle brim = new Rectangle(50,45,60,5); Group hat = new Group(stovepipe, brim); hat.setTranslateX(10); hat.setRotate(15); Group snowman = new Group(base, middle, head, leftEye, rightEye, mouth, topButton, bottomButton, leftArm, rightArm, hat); snowman.setTranslateX(210); snowman.setTranslateY(50); Circle sun = new Circle (450,50,30); sun.setFill(Color.GOLD); Rectangle ground = new Rectangle(0,250,500,100); ground.setFill(Color.STEELBLUE); Group root = new Group(ground, sun, snowman,text); Scene scene = new Scene(root,500,350, Color.LIGHTBLUE); primaryStage.setTitle("Snowman"); primaryStage.setScene(scene); primaryStage.show(); } }
changes needed is at the end of the code //************************************************************************ // Snowman.java Author: Lewis/Loftus // //...
WRITE A JavaFX APPLICATION THAT DRAWS A PICTURE OF A FLOWER. Use thick lines for stalks and rotated ellipses for petals. Put the sky and the ground as background. Don’t worry artistic quality, it should look simple. It should take about 45 to 75 statements. Also, have some line-by-line documentation that says what is going on, e.g., // draw petal // draw ground // draw leaf The snowman program should be used as a GUIDE. Snowman code : import javafx.application.Application;...
Write a JavaFX application that displays 10,000 very small circles (radius of 1 pixel) in random locations within the visible area. Fill the dots on the left half of the scene red and the dots on the right half of the scene green. Use the getWidth method of the scene to help determine the halfway point. This is what I have so far: import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.shape.Circle; import javafx.scene.paint.Color; import javafx.stage.Stage; import java.util.Random; import javafx.scene.Group; public class Class615...
GUI in java: Run the below code before doing the actionlistener: import java.awt.*; import javax.swing.*; public class DrawingFrame extends JFrame { JButton loadButton, saveButton, drawButton; JComboBox colorList, shapesList; JTextField parametersTextField; DrawingFrame() { super("Drawing Application"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JToolBar toolbar = new JToolBar(); toolbar.setRollover(true); toolbar.add(loadButton=new JButton("Load")); toolbar.add(saveButton=new JButton("Save")); toolbar.addSeparator(); toolbar.add(drawButton=new JButton("Draw")); toolbar.addSeparator(); toolbar.addSeparator(); toolbar.add(new...
Use Kilometer Converter application code to write Temperature
Converter application to convert degrees Fahrenheit into degrees
Celsius ((F - 32)*5/9). It needs to be JavaFX
1 import javafx.application. Application; 2 import javafx.stage. Stage; 3 import javafx.scene. Scene; 4 import javafx.scene.layout.HBox; 5 import javafx.scene.layout. VBox; 6 import javafx.geometry.Pos; 7 import javafx.geometry.Insets; 8 import javafx.scene.control.Label; 9 import javafx.scene.control. TextField; 10 import javafx.scene.control.Button; 11 import javafx.event. EventHandler; 12 import javafx.event. ActionEvent; 13 14 ** 15 * Kilometer Converter application 16 17 18 public...
Binary Search Tree Part A: The code attached in this document is a sample code to demonstrate insert operation in binary search tree. Please fill in the missing part for the insert method to make the program work. The expected output should be as follows. 20 30 40 50 60 70 80 Part B: Find Lowest Common Ancestor (LCA) of a Binary Search Tree. According to WikiPedia definition , The lowest common ancestor is defined between two nodes v and...
A Java Problem. In this problem you are going write a class to
model a traffic light that can cycle through colors, red, green,
yellow. To do this, you will have to maintain the state of the
traffic light. Maintaining state is one of the design pattern
discussed in this week's lesson. The state of the
TrafficLight indicates which light is lit. It
changes every time the TrafficLight cycles.
Specification
TrafficLight will have a constructor that takes the x and...
Can you take a look at my code that why the maxDepth function is not working? public class BinaryTree { class Node{ int key; Node left,right; public Node(int item) { key = item; left = right = null; } } Node root; public void BinaryTree(){ root = null; } void...
Modify the NervousShapes program so that it displays equilateral
triangles as well as circles and rectangles. You will need to
define a Triangle class containing a single instance variable,
representing the length of one of the triangle’s sides. Have the
program create circles, rectangles, and triangles with equal
probability. Circle and Rectangle is done, please comment on your
methods so i can understand
*/
package NervousShapes;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.imageio.*;
import javax.swing.*;
import javax.swing.event.*;
public class...
Java Programming Language Edit and modify from the given code Perform the exact same logic, except . . . The numeric ranges and corresponding letter grade will be stored in a file. Need error checking for: Being able to open the text file. The data makes sense: 1 text line of data would be 100 = A. Read in all of the numeric grades and letter grades and stored them into an array or arraylist. Then do the same logic....
In Lab 5, you completed the MyRectangle class, which is a simple representation of a rectangle. Review Lab 5 before completing this lab and retrieve the MyRectangle class that you completed for this lab, since you will need it again in this lab. Before starting this lab, edit your MyRectangle class in the following way: • change the declaration of your instance variables from private to protected This will enable access of these variables by your MySquare subclass. Here is...