In the createContents method of the FactorialButton program in Figure 17.8a, what type of object calls the
Question:
In the createContents method of the FactorialButton program in Figure 17.8a, what type of object calls the add methods?
Figure 17.8a:
Transcribed Image Text:
/********************************** * Factorial Button.java * Dean & Dean * * When user clicks button or presses Enter with cursor in input * text box, entered number's factorial displays in output text box. ******************************************************************/ import javax.swing. *; import java.awt. *; import java.awt.event. *; public class Factorial Button extends JFrame { private static final int WIDTH = 300; private static final int HEIGHT = 100; private JTextField xBox; // holds user entry private JTextField xfBox; // holds generated factorial //************************** public Factorial Button() ( createContents(); setVisible(true); setTitle("Factorial Calculator"); setSize (WIDTH, HEIGHT); set Layout (new FlowLayout()); set DefaultCloseOperation (EXIT_ON_CLOSE); } // end FactorialButton constructor //************ ***************************** ******* private void createContents() ( ******* xBox = new JTextField(2); xfBox= new JTextField(10); xfBox.setEditable(false); JLabel xLabel= new JLabel("x:"); JLabel xfLabel= new JLabel("x! :"); JButton btn = new JButton("Factorial"); Listener listener = new Listener(); add(x Label); add(xBox); add(xfLabel); add (xfBox); add (btn); xBox. addActionListener(listener); btn.addActionListener(listener); } // end create Contents ********************* ************ Here, we register the same listener with two different components.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 100% (QA)
The object ...View the full answer
Answered By
Branice Buyengo Ajevi
I have been teaching for the last 5 years which has strengthened my interaction with students of different level.
4.30+
1+ Reviews
10+ Question Solved
Related Book For
Introduction To Programming With Java A Problem Solving Approach
ISBN: 9781260575248
3rd International Edition
Authors: John Dean
Question Posted:
Students also viewed these Computer science questions
-
Carol Harris, Ph.D, CPA, is a single taxpayer and she lives at 674 Yankee Street, Durham, NC 27409. Her Social Security number is 793-52-4335. Carol is an Associate Professor of Accounting at a local...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
Given the graph of a degree 5 polynomial below, complete the table of values for either the x-value of a zero, or the multiplicity of the zero. Write roots in order from least to greatest. Root with...
-
Consider the insurance database of Figure, where the primary keys are underlined. Construct the following QBE queries for this relational-database. a. Find the total number of people who owned cars...
-
Mark Gershon, owner of a musical instrument distributorship, thinks that demand for guitars may be related to the number of television appearances by the popular group Maroon 5 during the previous...
-
Journal entries and adjusting entries of foreign currency commitment Sean, Inc., a retailer based in the United States, entered into a forward contract with 250,000, payable in 90 days to Queen NV in...
-
A project will cost $50,000. The benefits at the end of the first year are estimated to be $10,000, increasing at a 10% uniform rate in subsequent years. Using an 8-year analysis period and a 10%...
-
Which of the following is the proper way to adjust the cost of debt to estimate the after-tax cost of debt? Rd(1+Td)Rd(1Td)Rd(1Td)Rd(1+Td)
-
In the FactorialButton program in Figures 17.8a and 17.8b, what component fires the event that the listener handles? Figures 17.8a: Figures 17.8b: /********************************** *...
-
If you want to implement an event handler with an anonymous inner class, what argument do you give to the addActionListener method to register the listener?
-
In Problems 1328, use properties of logarithms to find the exact value of each expression. Do not use a calculator. log 8 2 + log 8 4
-
Q. Probabilities of three teams A, B and C of winning the first prize of a business case competition are 3/9, 2/9, 3/9 respectively. These three teams are equally likely to win the prize. True False...
-
Univex is a calendar year, accrual basis retail business. Univex hold less than 20% of IBM stock. Its financial statements provide the following information for the year: Revenues from sales of goods...
-
Consider the unadjusted trial balance of Fabuloso, Inc. at December 31, 2023, and the related month-end adjustment data. (Click the icon to view the month-end adjustment data.) Requirements 1....
-
5.3 BEP Example Bill Braddock is considering opening a Fast 'n Clean Car Service Center. He estimates that the following costs will be incurred during his first year of operations: Rent $9,200,...
-
The following is the text for an opinion on internal control for W Company, an issuer. Some words or phrases have been replaced with numbers (e.g., [1], [2], etc.). Select from the option list...
-
Find the indicated derivatives in problem. g(x) if g(x) = 5x-7 - 2x-4
-
Compile data on consumption and expenditures for the following categories in 30 different countries: (1) food and beverages, (2) clothing and footwear, (3) housing and home operations, (4) household...
-
Graph each linear or constant function. Give the domain and range. F(x) = 1 4 x + 1
-
Prove each of the following for every positive integer n. Use steps (a)(e) as in Exercises. (a m )n = a mn (Assume a and m are constant.) Steps Let Sn represent the given statement, and use...
-
In FIGURE CP7.54, find an expression for the acceleration of m 1 . The pulleys are massless and frictionless. FIGURE CP7.54 y Frictionless ,
-
WISE-HOLLAND CORPORATION On June 15, 2013, Marianne Wise and Dory Holland came to your office for an initial meeting. The primary purpose of the meeting was to discuss Wise-Holland Corporation's tax...
-
Stock in ABC has a beta of 0.9. The market risk premium is 8%, and T-bills are currently yielding 5%. The company's most recent dividend is $1.60 per share, and dividends are expected to grow at a 6%...
-
Sweeten Company had no jobs in progress at the beginning of March and no beginning inventories. The company has two manufacturing departments --Molding and Fabrication. It started, completed, and...
Study smarter with the SolutionInn App