Starting Out with Java: Early Objects (6th Edition)
6th Edition
ISBN: 9780134462011
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 11, Problem 6AW
Explanation of Solution
“Image” and “ImageView” classes:
- “Image” class is used to load graphical images which can be displayed with the help of “ImageView” class.
- The package used for the image class is “javafx.scene.image.Image” which help to load the image from the URL or filename.
- It is possible to set one image to many “ImageView” because, one image can be displayed in multiple views. Whereas, it is not possible to display one “ImageView” multiple times because an “ImageView” node cannot be shared.
- Syntax to create image: Image image_object = new Image(URL);
- Syntax to view image: ImageView imageview_object = new ImageView(image_object);
Step 1: Create an object for “Image” to load the image.
Step 2: Give the given URL “http://www.greendale.edu/images/” followed by the image name “Cat.png” as the argument to load image from the internet location.
Code to create “Image” object:
The code to create “Image” object to load “Cat...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Getting Bigger.pdf
PDF
O File | C:/Users/19377/Downloads/Getting%20Bigger.pdf
+
Purpose
To review more advanced aspects of user interfaces and event handlers
Directions
Create an interface for a program that looks like the one in the first image below.
Then add an event handler to the JSlider that changes the font size of the text in the
JTextArea according to the value on the slider, as illustrated in the second image.
Note: These directions are intentionally vague. Use the internet and whatever other
resources you have available to try to piece together how to do this. Be sure to cite
any sources you use as comments in your code.
Text Decorator
Type here..
Font Size:
25
50
75
100
Text Decorator
Type here...
Туре
Font Size:
25
50
75
100
11:35 AM
e Type here to search
28°F Cloudy
2/23/2022
(8)
JavaScript Assignment
For this assignment you are only to use external CSS and JavaScript. This assignment shouldhave no templates or frameworks.
The Fruits to be used are Apple, Orange, Pear, and Pineapple. Write the code in a way that allows it to pull the images from a folder inside the main folder named “images." The file names are as follows Apple.png, Orange.png, Pear.png, and Pineapple.png.
You are to create a child's game. The game will have a title in the head of the boilerplate withyour name. The name of the game will be Fruit Game which will need to be included in theheader of the browser using a h1 element. You will display an image of a fruit. Under the imagethere will be room for text for the name of the fruit but not displayed at the start. You will havefour buttons with names for the fruits available. When the button with the fruit name is clickedthe name of the fruit will appear under the image of the fruit. If the button and the name of thefruit is the same then you…
create an image file programmatically. Your image file should be called OnTheFlyPy.ppm and the code you write to create should be in a public static void makePPM() method defined in the provided Main.java class.
Your OnTheFlyPy.ppm should be be 100 pixels wide and 100 pixels tall and the PPM header lines should be correct.
The first two rows and last two rows in the OnTheFlyPy.ppm should be red (Red=255, Green=0, Blue= 0).
The first two columns and last two columns in the OnTheFlyPy.ppm (except for the part that overlaps with the red pixels you created in the previous part) should should be blue (Red=0, Green=0, Blue= 255).
The remaining pixels in your OnTheFlyPy.ppm image should be white (Red=255, Green=255, Blue= 255). Here is a picture of what your final image should look like:
import java.io.*;
public class Main{ public static void main(String[] args) { makePPM(); } public static void makePPM() {
} }
Chapter 11 Solutions
Starting Out with Java: Early Objects (6th Edition)
Ch. 11.1 - What is a user interface?Ch. 11.1 - How does a command line interface work?Ch. 11.1 - Prob. 11.3CPCh. 11.1 - Prob. 11.4CPCh. 11.2 - What is JavaFX?Ch. 11.2 - Prob. 11.6CPCh. 11.2 - Prob. 11.7CPCh. 11.2 - Prob. 11.8CPCh. 11.2 - Prob. 11.9CPCh. 11.2 - Prob. 11.10CP
Ch. 11.2 - What is the purpose of the launch method of the...Ch. 11.2 - What is the purpose of the Application classs...Ch. 11.2 - The program in Code Listing 12-1 calls a Stage...Ch. 11.2 - Prob. 11.14CPCh. 11.3 - What is the general difference between an HBox...Ch. 11.3 - Prob. 11.16CPCh. 11.3 - Prob. 11.17CPCh. 11.3 - How do you change the alignment of an HBox...Ch. 11.3 - Prob. 11.19CPCh. 11.4 - Prob. 11.20CPCh. 11.4 - Prob. 11.21CPCh. 11.4 - Prob. 11.22CPCh. 11.4 - Prob. 11.23CPCh. 11.4 - Prob. 11.24CPCh. 11.5 - Prob. 11.25CPCh. 11.5 - Prob. 11.26CPCh. 11.5 - Prob. 11.27CPCh. 11.5 - Prob. 11.28CPCh. 11.6 - Prob. 11.29CPCh. 11.6 - Prob. 11.30CPCh. 11.6 - Prob. 11.31CPCh. 11.6 - Prob. 11.32CPCh. 11.7 - In what package is the TextField class?Ch. 11.7 - Prob. 11.34CPCh. 11.8 - Prob. 11.35CPCh. 11.9 - Prob. 11.36CPCh. 11.9 - Prob. 11.37CPCh. 11 - Prob. 1MCCh. 11 - This type of control appears as a rectangular...Ch. 11 - Typically, when the user clicks this type of...Ch. 11 - Prob. 4MCCh. 11 - Prob. 5MCCh. 11 - Prob. 6MCCh. 11 - Prob. 7MCCh. 11 - All JavaFX applications must extend the class. a....Ch. 11 - This container arranges its contents in a single,...Ch. 11 - Prob. 10MCCh. 11 - You use this class to actually display an image....Ch. 11 - The EventHandler interface specifies a method...Ch. 11 - Prob. 13MCCh. 11 - Prob. 14MCCh. 11 - Prob. 15TFCh. 11 - Prob. 16TFCh. 11 - Prob. 17TFCh. 11 - Prob. 18TFCh. 11 - Prob. 1FTECh. 11 - Prob. 2FTECh. 11 - Assume hbox is an HBox container: // This code has...Ch. 11 - Prob. 4FTECh. 11 - Prob. 5FTECh. 11 - Prob. 1AWCh. 11 - Prob. 2AWCh. 11 - Prob. 3AWCh. 11 - Prob. 4AWCh. 11 - Prob. 5AWCh. 11 - Prob. 6AWCh. 11 - Prob. 7AWCh. 11 - Prob. 8AWCh. 11 - Prob. 9AWCh. 11 - Prob. 10AWCh. 11 - Prob. 11AWCh. 11 - Prob. 12AWCh. 11 - Prob. 13AWCh. 11 - Assume borderPane is the name of an existing...Ch. 11 - Prob. 1SACh. 11 - What is the purpose of the Application classs...Ch. 11 - What is the purpose of the Application classs...Ch. 11 - Prob. 4SACh. 11 - Prob. 5SACh. 11 - What two classes do you use to display an image?Ch. 11 - Prob. 7SACh. 11 - Prob. 8SACh. 11 - Prob. 9SACh. 11 - Prob. 10SACh. 11 - Prob. 11SACh. 11 - Latin Translator Look at the following list of...Ch. 11 - Name Formatter Create a JavaFX application that...Ch. 11 - Tip, Tax, and Total Create a JavaFX application...Ch. 11 - Property Tax A county collects property taxes on...Ch. 11 - Prob. 5PCCh. 11 - Prob. 6PCCh. 11 - Travel Expenses Create a GUI application that...Ch. 11 - Joes Automotive Joes Automotive performs the...Ch. 11 - Tic-Tac-Toe Simulator Create a JavaFX application...Ch. 11 - Prob. 10PC
Knowledge Booster
Similar questions
- Write a code to the following image using Console.WriteLine.arrow_forwardDo the interface l.arrow_forwardCreate animation in Figure tomeet the following requirements:■■ Allow the user to specify the animation speed in a text field.■■ Get the number of images and image’s file-name prefix from the user. Forexample, if the user enters n for the number of images and L for the imageprefix, then the files are L1.gif, L2.gif, and so on, to Ln.gif. Assume theimages are stored in the image directory, a subdirectory of the program’s classdirectory. The animation displays the images one after the other.■■ Allow the user to specify an audio file URL. The audio is played while theanimation runs.arrow_forward
- in javascript Create a function that will load a new image from the website https://cataas.com/cat every 10 seconds, and will stop this interval when the SPACEBAR is pressed.arrow_forwardSkybox class (M Visual Studios): Modify the skybox class appropriately to handle cube mapping. This involves loading six images for the cube map, setting appropriate texture parameters, and ensuring the normals of the cube model that encoded and runs sucessfully Task: The upload_CubeMap_images() function in the Skybox.cpp file needs to be implemented sucessfully according to the instructions.Instructions: Enable cube mapping: Use glEnable(GL_TEXTURE_CUBE_MAP) to enable cube mapping. Generate a texture ID: Use glGenTextures() to generate a texture ID to hold the cube map. This ID is stored in the tex_buffer_ID member variable of the Skybox class. Bind the texture ID: Use glBindTexture() to bind the texture ID as the current buffer. Make sure to bind it as a cube map using GL_TEXTURE_CUBE_MAP. Load six images: Load all six images into the correct "place" in the cube map. You can use the provided file paths (BMP_NEG_X_FILE_PATH, BMP_NEG_Y_FILE_PATH, etc.) to load the images. (Make sure to…arrow_forwardPicture card: Create a picture card that looks SIMILAR to this. There are images available in the "images" directory to assist you in making this card. They are not the same images, but there is an image of a desert and a person. Picture card In this screenshot, the title is "Title goes here", the secondary text is "Secondary text", and the body text is "Greyhound divisively hello coldly wonderfully marginally far upon excluding." The card's root element is a with a class of "card". The card is 344px wide. The desert picture is 194px tall. The padding between the body text and everything else is 16px. The color of the title text is #000. The color of the secondary and body texts is #232F34. The size of the person picture is 40px in diameter. The size of the body text is 11px. The size of the title is 22px. For the padding or margin around any other elements, use your best judgment to make it look like the screenshot.arrow_forward
- You can also download the image file from https://www.dropbox.com/scl/fi/ztmuke5mlonrb3e0jdpuj/Santa.jpg?rlkey=lfdzstv649h141jolqdh2kagv&dl=0(1) Write a code to change all red color pixels into blue.(2) Write a code to change only the right half of the red hat into blue, using two ifarrow_forwardCreate a GUI application with icons for adding things to an unordered list's top, after, bottom, and front. Your application must provide a text field that can accept a string as input for each of the add steps. The user should be able to pick both the element that will be deleted and the element that will be added afterward. Create a GUI application with icons for adding things to an unordered list's top, after, bottom, and front. Your application must provide a text field that can accept a string as input for each of the add steps. The user should be able to pick both the element that will be deleted and the element that will be added afterward.arrow_forward1. Write a program that displays four images along with their label texts in a grid pane, as shown below. You may use the images available in the folder "LabFiles" | Flags Sultanate of Oman Republic of Yemen Kingdom of Saudi Arabia United Arab Emirates Check Point: How the nodes (elements) are arranged in a grid pane? How can you add nodes to the grid pane? 2. Create different versions of this program to test different type of pane layouts.arrow_forward
- Based on your algorithm(User valida- tion), write a program that does the same thing using HTML, CSS, and JavaScript. Use the scoring guide below: Import CSS design using link tag. The login page should be presentable. Import JavaScript using script tag Write JSON object in your JS file containing the following account: Username: john, Password: smith Username: mary, Password: woods Username: steve, Password: jobs •The program should be able to count the num- ber of login attempts. If it reaches the maximum threshold of 3 incorrect credentials, it should dis- able the login button. If the user was able to login with correct credentials(username and its corresponding password), use an alert to display ”successfully logged in!”. The program should be able to determine what goes wrong, for example, the ”user does not ex- ist” only appears when the username does not match to the accounts inside the JSON, and ”Incorrect password” if the username is correct…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_forwardHands-On Project 1-3In this project, you will explore how to write text to a specific element in your web page in response to theonclick event handler. To complete the exercise, you will apply the following JavaScript expression:document.getElementById('id').innerHTML = 'text';where id is the value of the id attribute for the page element and text is the text of the content to be writteninto the element. You will use this expression to enhance a web form by displaying the message “Thank you foryour order” when the user clicks the Submit button. Figure 1-25 shows the completed web page.Do the following:1. Use your code editor to open project01-03_txt.html from the HandsOnProject_01 folder. Enter your name and the date in the comment section of the document and save it as project01-03.html.2. Scroll down to the bottom of the file and locate the input element for the Submit button.3. Add an onclick event handler to the <input> tag that changes the innerHTML value of the page element…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT