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...
-
A 250-V dc shunt-wound motor is used as an adjustable-speed drive over the range from 0 to 2000 r/min. Speeds from 0 to 1200 r/min are obtained by adjusting the armature terminal voltage from 0 to...
-
The level of pollution because of vehicular emissions in a city is not regulated. Measurements by the local government of the change in flow of vehicles and the change in the level of air pollution...
-
The following table contains the activities for planning a wedding and the activity time estimates. However, the precedence relationships between activities are not included. Using your best...
-
The following data have been extracted from the records of Puzzle Incorporated: Production level, in units Variable costs Fixed costs Mixed costs Total costs Required: a. Calculate the missing costs....
-
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?
-
Explain why a padded dashboard makes a car safer in the event of an accident.
-
It would be unfair to tax the sale of medical or legal services because effectively that would be taxing peoples misfortune. Discuss this viewpoint. Would the same principle apply to the sale of car...
-
Periodically, it is proposed that the federal government reduce its role in intergovernmental fiscal relations by eliminating a number of smaller matching intergovernmental grants and simultaneously...
-
The evidence about interstate investment decisions seems to show that state incentives have very different effects for different industries. In some industries, investment is greatly influenced by...
-
Suppose that the apartment building you live in at college has only one water meter for the entire building. The landlord receives a water bill from the city each quarter based on the gallons of...
-
State-local governments often use their borrowing authority to provide low-cost loans to the private sector through the sale of tax-exempt revenue bonds. Taking mortgage revenue bonds as an example,...
-
Describe two ways to handle a situation in which there are a large number of use cases.
-
Phosgene, COCl2, is a toxic gas used in the manufacture of urethane plastics. The gas dissociates at high temperature. At 400oC, the equilibrium constant Kc is 8.05 104. Find the percentage of...
-
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 ,
-
What are 6 typical items that are subtracted or deducted from gross pay to get to net pay?
-
Mother dies intestate only a few years after Marc graduates from University of Wisconsin. Her estate totals $36,000. Her only heirs are her three children and the proper document has been signed. How...
-
With this information, can you say that is it worth it to take ECE in Canada, The cost of Early Childhood Education (ECE) in Canada varies depending on the institution and the province. On average,...
Study smarter with the SolutionInn App