Concept explainers
Suppose you change the order of the drawing commands in Listing 3.6 to the following. Will the gc.setFill picture change? If so. how will it change?
//Draw mouth:
gc.setFill (Color.RED);
gc.strokeArc (X_MOUTCH, Y_MOUTH, MOUTH_WIDTH,
MMOUTH_HEIGHT, MOUTH_START_ANGLE,
MOUTH_EXTENT_ANGLE), ArcType. OPEN;
//Draw face interior and outline:
gc.setFill (Color.YELLOW);
gc.filloval(X_FACE, Y_FACE,
FACE_DIAMETER, FACE_DIAMETER);
gc.setFill (Color.BLACK);
gc.strokeoval (X_FACE, Y_FACE,
FACE_DIAMETER, FACE_DIAMETER);
//Draw eyes:
gc.setFill (Color.BLUE);
gc.fillOval (X_RIGHT_EYE, Y_RIGHT_EYE,
EYE_WIDTH, EYE_HEIGHT);
gc.fillOval (X_LEFT_EYE, Y_LEFT_EYE,
EYE_WIDTH, EYE_HEIGHT);
//Draw nose:
gc.setFill (Color.BLACK);
gc.fillOval(X_NOSE, Y_NOSE,
NOSE_DIAMETER, NOSE_DIAMETER);
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Problem Solving with C++ (9th Edition)
Starting Out with Python (3rd Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Starting Out with C++ from Control Structures to Objects (8th Edition)
- Add a JTextField and a JTextArea to the frame. Initialize the field to an empty string and the text area to “||”. Modify the program so that the contents of the field are appended to the area each time the user clicks the button. For example, if the user enters “xxx” in the field and clicks the button three times, the area contains “||xxx||xxx||xxx||”. Go off this code: import javax.swing.*;import java.awt.Color;import java.awt.event.*; public class MyCustomFrame extends JFrame{  // instance variables - replace the example below with your own  private JButton button;  private JLabel label;  // add two more instance variables for JTextField and a JTextArea t  // ...      private static final int FRAME_WIDTH = 800;  private static final int FRAME_HEIGHT = 800;    public MyCustomFrame()  {   JPanel panel = new JPanel();   panel.setBackground(Color.RED);   button = new JButton("Push Me");       // create a listener object and add it to the button   //...…arrow_forwardchange below code to the example photo page. the photo is just example but the layout should be like that  @extends('base') @section('main')     <div class="py-12">         <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">             <div class="bg-white overflow-hidden shadow-xl sm:rounded-lg">                     <div class="row">                         <div class="col-sm-12">                           @if(session()->get('success'))                             <div class="alert alert-success text-center">                               {{ session()->get('success') }}                             </div>                           @endif                         </div>                         <div class="col-sm-12">                         <br />                         <h3 class="display-5 text-center">Room List</h3>                           <table class="table table-striped">…arrow_forwardUsing comments within the code itself, can you provide an line by line explanation of the below JavaScript file? The file itself deals with WebGl and if that helps you. Please and thank you JavaScript file: function mat2() { var out = new Array(2); out[0] = new Array(2); out[1] = new Array(2);  switch ( arguments.length ) { case 0: out[0][0]=out[3]=1.0; out[1]=out[2]=0.0; break; case 1: if(arguments[0].type == 'mat2') { out[0][0] = arguments[0][0][0]; out[0][1] = arguments[0][0][1]; out[1][0] = arguments[0][1][0]; out[1][1] = arguments[0][1][1]; break; }  case 4: out[0][0] = arguments[0]; out[0][1] = arguments[1]; out[1][0] = arguments[2]; out[1][1] = arguments[3]; break; default: throw "mat2: wrong arguments"; } out.type = 'mat2';  return out; }  //----------------------------------------------------------------------------  function mat3() { // v = _argumentsToArray( arguments );  var out = new Array(3); out[0] = new Array(3); out[1] = new Array(3); out[2] = new Array(3);…arrow_forward
- In this exercise, you’ll use radio buttons to determine whether the conversion is from Fahrenheit to Celsius or vice versa. You’ll also modify the DOM so the labels change when a radio button is clicked, and the page displays an error message when the user enters invalid data. 2. Note that the JavaScript file has some starting JavaScript code, including the $() function, three helper functions, three event handler functions, and a DOMContentLoaded event handler that attaches the three event handlers. 3. Review how the toCelsius() and toFarhenheit() event handler functions call the toggleDisplay() helper function and pass it strings to display. Also note that the toggleDisplay() helper function and the convertTemp() event handler function are incomplete. 4. Code the toggleDisplay() function so it changes the text in the labels for the text boxes to the values in the parameters that it receives. It should also clear the disabled text box where the computed temperature is displayed. 5.…arrow_forwardPlease rewrite this animation code below so that it performs the same functions in a java file instead of the files .css,.js, and .html in visual studios. You would need to import javaFX and include your images for creature.png,forestbackground.png,human.png, and human2.png. Also attach a screenshot of the running animation in java. script.js const dialogue = [   { character: 'Narrator', text: "In the dead of night, beneath a moon veiled by misty clouds, a lone figure trudged along a desolate forest path." },   { character: 'Narrator', text: "Unknown to her, she was not alone." },   { character: 'Human', text: "Who's there? Show yourself!" },   { character: 'Creature', text: "You venture into realms unknown, mortal. What brings you to these woods?" },   { character: 'Human', text: "I seek passage to the village beyond. I mean no harm." },   { character: 'Creature', text: "Harm is but a shadow in these woods, mortal." },   { character: 'Human', text: "What do you mean?…arrow_forwardIf you call setLineWidth to specify the GraphicsContext’s line thickness, all subsequent GraphicsContext method calls that draw lines or shape borders will use this setting. State whether the statement is true or false. If false, explain why.arrow_forward
- Please provide the whole JAVA source code for attached screenshot's assignment.arrow_forwardIn this lab, you will use a timer to animate the movement of a heart image to the location where the mouse clicks, as shown below. In jacascript, please! The given web page shows a heart image. When the user clicks anywhere in the page, the startAnimation() function is called. startAnimation() determines where the user clicked and calls moveImage() with the clicked (x, y) coordinate. moveImage() moves the heart 1 pixel in the direction of the given (x, y) coordinates. Make the following JavaScript modifications using clearInterval() and setInterval() where appropriate: In startAnimation(), add an if statement that stops the timer with the ID timerId if timerId is not null. In startAnimation(), start a timer that calls moveImage(clickX, clickY) every 10 milliseconds. Save the timer ID in the timerId variable. Add an if statement in moveImage() that stops the timer with the ID timerId if (imgX, imgY) is equal to (centerX, centerY). Also set timerId to null. After the…arrow_forwardwhat is the difference between an empty text placeholder and a completedplaceholder with title or bullets.arrow_forward
- Please fix this so when i press Addorder i am able to add the data and the when i press save the data works and is stored on a table to see on the gui  import java.awt.*; import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class OrderEntryScreen extends JFrame {   private JTextField txttableNumber;   private JTextField txtcapacity;   private JTextField txtsubtotal;   private JTextField txtID;   private JTextField txtestimatedWaitTime;   private JTextField txtDate;   private JTextField txtTime;   private JButton SaveCommand;   private JButton commandCloser;   private JButton ClearAll;   // private JButton MakeOrder;   // private JButton MakeReservation;   private JCheckBox checkBox; // variable that was stated to be added for checkbox   private Driver orderlist1; // Variable for PersonListing so we can create the instance   // private Driver orderlist1;   private JPanel pnlCommand;   private JPanel…arrow_forwardIn your HTML file, please do the following: Add an h1 tag with a class of text-center and add the text of "Lesson 13 Project". Create a div class of container Inside the container, create a div id of test-input Inside the test-input, add the following: input box with an id of isValidInput button with an id of isValidBtn Outside of the test-input, but inside the container, create a paragraph tag with an id of isValidMsg CSS In your stylesheet, please add the following: Set an asterisk with a property of box sizing equal to border box.Set the body with the following properties:set a property of font-family and set it equal to sans-serif.set a minimum height of 100%.set a vertical overflow of hidden.Set a class called text-center and set it to align the text to the center.Create a container class, and add the following properties:set the display property to flexjustify the content to centeralign the items to centerset the height to 100 viewport heightset the flex direction to…arrow_forwardAssuming I have a Pixel, called px, write the code to change its contents to its greyscale equivalent.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage