Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
4th Edition
ISBN: 9780134787961
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 13, Problem 12AW
Explanation of Solution
TextArea:
- The “TextArea” is a multiline “TextField” that can take many lines of input.
- It is present in the “javafx.scene.control” package.
- The “TextArea” class contains two constructors such as no-argument constructor and argument constructor.
- The “no-argumnet constructor” is used to create an empty “TextArea”.
- The “argument constructor” accepts a “String” argument in “TextArea” field.
- The “TextArea” control performs a word wrapping.
- The line breaks always occur between words, not in the middle of a word.
- User can enable the text wrapping by using “TextArea” class “setWrapText()” method.
- This method takes a “boolean” argument.
- If the user passes the argument is “true”, then text wrapping is enabled.
- Otherwise, the text wrapping is disabled.
Example:
The example for “no-argument constructor” and “argument constructor” is shown below:
//for no-arg constructor
TextArea sampleArea = new TextArea();
- Above statement creates a TextArea with no arguments.
//for argument constructor
TextArea sampleArea = new TextArea("This is an example TextArea");
- Above statement creates a TextArea with arguments.
The example for creating an empty “TextArea” with the height, width and line wrapping is shown below:
//create the empty TextArea control
TextArea exampleText = new TextArea();
//set a width of 30 columns to empty "TextArea"
exampleText...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
1. The main function creates 5 pixels with random red, green, and blue values. Complete the id_color function to return “red” if the red value is greater than the green and blue, “green” if the green value is greater than the red and blue, and “blue” if the blue value is greater than the red and green. If there is no clear maximum value (for example, if the red and green values are the same) return None. Do not change the main function.
1. The main function creates 5 pixels with random red, green, and blue values. Complete the id_color function to return “red” if the red value is greater than the green and blue, “green” if the green value is greater than the red and blue, and “blue” if the blue value is greater than the red and green. If there is no clear maximum value (for example, if the red and green values are the same) return None. Do not change the main function.
import imageimport random
def id_color(p):'''Returns the dominant color of pixel p'''pass#Your code here to determine the dominant color and return a string identifying it#Hint: get the red, green & blue values and use an if statement to determine which has the highest value
def main():'''Controls the program'''for i in range(5): #Loop 5 timesr = random.randrange(0, 256)g = random.randrange(0, 256)b = random.randrange(0, 256)print(r, g, b) #Show the pixel red, green & blue valuesnew_pixel = image.Pixel(r, g, b)print(id_color(new_pixel))
main()…
You may use the following code segment:
// Create lightsPane Pane lightsPane = new Pane();Circle redCircle = new Circle(100, 60, 20);Circle yellowCircle = new Circle(100, 110, 20);Circle greenCircle = new Circle(100, 160, 20);redCircle.setStroke(Color.BLACK);redCircle.setFill(Color.WHITE);yellowCircle.setStroke(Color.BLACK);yellowCircle.setFill(Color.WHITE);greenCircle.setStroke(Color.BLACK);greenCircle.setFill(Color.WHITE);Rectangle rectangle = new Rectangle(65, 25, 70, 170);rectangle.setStroke(Color.BLACK);rectangle.setFill(Color.WHITE);lightsPane.getChildren().addAll(rectangle, redCircle, yellowCircle, greenCircle);
Chapter 13 Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Ch. 13.1 - What is the type selector name that corresponds to...Ch. 13.1 - Prob. 13.2CPCh. 13.1 - Prob. 13.3CPCh. 13.1 - Prob. 13.4CPCh. 13.1 - Prob. 13.5CPCh. 13.1 - Prob. 13.6CPCh. 13.1 - Prob. 13.7CPCh. 13.1 - Prob. 13.8CPCh. 13.1 - Prob. 13.9CPCh. 13.1 - Prob. 13.10CP
Ch. 13.1 - Prob. 13.11CPCh. 13.2 - Prob. 13.12CPCh. 13.2 - Prob. 13.13CPCh. 13.2 - Prob. 13.14CPCh. 13.2 - Prob. 13.15CPCh. 13.3 - How do you determine in code whether a CheckBox is...Ch. 13.3 - In code, how do you make a CheckBox appear...Ch. 13.3 - What type of event do CheckBox controls generate...Ch. 13.4 - How do you set the size of a ListView?Ch. 13.4 - Prob. 13.20CPCh. 13.4 - Prob. 13.21CPCh. 13.4 - Prob. 13.22CPCh. 13.4 - How do you set the orientation of a ListView...Ch. 13.5 - Prob. 13.24CPCh. 13.5 - Prob. 13.25CPCh. 13.5 - Prob. 13.26CPCh. 13.5 - Prob. 13.27CPCh. 13.6 - Prob. 13.28CPCh. 13.6 - Prob. 13.29CPCh. 13.6 - Prob. 13.30CPCh. 13.7 - What is the difference between a TextArea and a...Ch. 13.7 - Prob. 13.32CPCh. 13.7 - Prob. 13.33CPCh. 13.7 - Prob. 13.34CPCh. 13.7 - Prob. 13.35CPCh. 13.8 - Briefly describe each of the following menu system...Ch. 13.8 - What class do you use to create a menu bar?Ch. 13.8 - What class do you use to create a menu?Ch. 13.8 - What class do you use to create a menu item?Ch. 13.8 - What class do you use to create a radio menu item?...Ch. 13.8 - How do you create a relationship between radio...Ch. 13.8 - What class do you use to create a check menu item?...Ch. 13.8 - What type of event do menu items generate when...Ch. 13.9 - In what package is the FileChooser class?Ch. 13.9 - Prob. 13.45CPCh. 13.9 - Prob. 13.46CPCh. 13.9 - How do you determine the file that the user...Ch. 13 - When a selector name starts with a period in a...Ch. 13 - Prob. 2MCCh. 13 - Prob. 3MCCh. 13 - Prob. 4MCCh. 13 - Prob. 5MCCh. 13 - In the hexadecimal color value #05AAFF, the AA...Ch. 13 - Prob. 7MCCh. 13 - Prob. 8MCCh. 13 - Prob. 9MCCh. 13 - Prob. 10MCCh. 13 - The __________control presents its items in a...Ch. 13 - Prob. 12MCCh. 13 - A __________ is like a TextField that can accept...Ch. 13 - You use this class to create a menu bar. a....Ch. 13 - Prob. 15MCCh. 13 - True or False: If you make any changes to an...Ch. 13 - Prob. 17TFCh. 13 - Prob. 18TFCh. 13 - Prob. 19TFCh. 13 - Prob. 20TFCh. 13 - Prob. 21TFCh. 13 - Prob. 22TFCh. 13 - True or False: A MenuBar object acts as a...Ch. 13 - True or False: A Menu object cannot contain other...Ch. 13 - Prob. 1FTECh. 13 - .label { -font-size: 14pt; }Ch. 13 - Prob. 3FTECh. 13 - Prob. 4FTECh. 13 - Prob. 1AWCh. 13 - Suppose we have a stylesheet named styles.css, and...Ch. 13 - Prob. 3AWCh. 13 - Prob. 4AWCh. 13 - Prob. 5AWCh. 13 - Prob. 6AWCh. 13 - Prob. 7AWCh. 13 - Prob. 8AWCh. 13 - Prob. 9AWCh. 13 - Assume a JavaFX application has a RadioButton...Ch. 13 - Write code that creates a ListView control named...Ch. 13 - Prob. 12AWCh. 13 - Prob. 13AWCh. 13 - Write the code that creates a menu bar with one...Ch. 13 - Prob. 1SACh. 13 - Prob. 2SACh. 13 - Prob. 3SACh. 13 - Prob. 4SACh. 13 - Prob. 5SACh. 13 - Prob. 6SACh. 13 - Prob. 7SACh. 13 - Prob. 8SACh. 13 - Prob. 9SACh. 13 - Dorm and Meal Plan Calculator A university has the...Ch. 13 - Skateboard Designer The Skate Shop sells the...Ch. 13 - Prob. 3PCCh. 13 - Smartphone Packages Cell Solutions, a cell phone...Ch. 13 - Shopping Cart System Create an application that...
Knowledge Booster
Similar questions
- Computer Programmingarrow_forward02 - Rectangular Prisms Prompt the user for three integers representing the sides of a rectangular prism. Calculate the surface area and volume of the prism, then draw three rectangles of asterisks portraying the top, side, and front view of the prism labeled accordingly (which set of numbers represent each view is at your discretion). Enter three integers: 2 5 6 Surface Area: 104 Volume 60 Top View (2 x 5): Side View (2 x 6): Front View (5 x 6):arrow_forwardThe correct code for changing background color of form is Select one: a. Me.Color = Blue b. Form.color = Blue c. Me.Color = Color.Blue d. My.color= Color.Bluearrow_forward
- A windows form application is required that captures marks scored by a student in two CATs via textboxes, then computes the difference between the two CATs and outputs the result on a textbox “txtResult” once a button “Compute Total” is clicked. Required: Sketch a suitable design of the Form application using the controls mentioned above. Write the code segment linked to the button “Compute Total” that will display the total of what the student has scored on the two assignments.arrow_forwardForm validation aims to make the user comfortable while downloading images from websites. O True False QUESTION 8 The isNaN() function verifies whether a value is an illegal number. O True O False QUESTION 9 Moving a mouse over an element is an example of events. O True O Falsearrow_forward3. Go to the project05-01.js file in your code editor. Below the initial code at the top of the file declare the timeID variable but do not set an initial value. 4. Declare the questionList variable, storing in it the node list created by the querySelectorAll() method using “div#quiz input" as the CSS selector. 5. Add an onclick event handler to the startQuiz object, running an anonymous function that sets the class attribute of the overlay object to “showquiz" and repeats the countdown () function every 1 second (every 1000 milliseconds), storing the id of the timed command in the global timeID variable you declared in Step 3. 6. Create the countdown () function to update the quiz clock. Within the function create an if else statement that tests whether the value of the timeLeft variable is equal to 0. If it is equal to 0, do the following: a. Use the clearInterval() method to cancel the timed command with the variable timeID. b. Declare a variable named totalCorrect and set it equal…arrow_forward
- Fast plsarrow_forwardBedDean-Comot Me bOe ety docsgoogle com/tum Alas g if you replace the question mark from the image by the y values from the rows and run the code, you can see an alert messagebox containing a message. Determine the output of this code given the y from the row values y- ?; x - (100%y)+(y/3); if (x2) alert("Good Morning!"); if(x--2) alert("God Bless!"); hello! Good Morning!. God Blesarrow_forwardHTML and CSSarrow_forward
- Matlaparrow_forwardURGENT!!! PLS HELP!! IT HAVE TO BE IN C CODE { int source, // DON'T EDIT THIS LINE destination, // DON'T EDIT THIS LINE weight; // DON'T EDIT THIS LINE}EDGE; // DON'T EDIT THIS LINEtypedef struct{ int num_vertices, // DON'T EDIT THIS LINE num_edges; // DON'T EDIT THIS LINE EDGE *edges; // DON'T EDIT THIS LINE}GRAPH; // DON'T EDIT THIS LINEGRAPH *init_graph(int vertices, int edges); // DON'T EDIT THIS LINEvoid fill_graph(GRAPH *graph); // DON'T EDIT THIS LINE int is_cycle(/*DON'T FORGET TO EDIT THIS LINE*/);void Kruskals_MST(GRAPH *graph); // DON'T EDIT THIS LINE int main() { GRAPH *graph = init_graph(10, 14); // DON'T EDIT THIS LINE fill_graph(graph);…arrow_forwardQ5/Private Sub Form Activate() Font.Name = "arial": Font. Bold = True: Font.Size = 14 start: Solve the question by visual basic 9 = InputBox("input wave length"., "input"., 6000, 2000) If q = "s" Then End Select Case q Case 0.005 To 0.009: Print, "Gamma ray" Case 0.01 To 5: Print, "X-ray" Case 10 To 3999: Print, "Ultraviolet" Case 4000 To 7499: Print "Visible Light" Case 7500 To 4000000#: Print, "Infrared" End Select GoTo start End Sub 2- Write the input and the output the programarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT