Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
3rd Edition
ISBN: 9780134038179
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
Expert Solution & Answer
Book Icon
Chapter 12, Problem 2FTE

Explanation of Solution

The given statement:

//define a class which implements ActionListener

private class ButtonListener implements ActionListener

{

    //override the method actionPerformed()

    public void actionPerformed()

    {

        // Code appears here.

    }

}

Error in the code:

The “actionPerformed()” method must have an “ActionEvent” parameter...

Blurred answer
Students have asked these similar questions
Purpose To review interfaces Directions Your task for this lab is to implement and test a class to store ratings of items. Your Rating class should have the following fields and methods: private double sumOfRatings - the sum of all of the ratings private int raters - the number of people who have rated an item public Rating () initialize both fields to zero public Rating (double sumofRatings, int raters) - initialize the fields to the parameter values public void addRating (double newRating) - increase the sumOfRatings by newRating and increase the number of raters by one public double getAverageRating () return the average rating; if there are no raters so far, return 0.0 public String toString() - display the average rating and how many reviews it is based on; for example, if the sum of the ratings is 32 and that is based on ratings from ten people, the toString method will return "3.2 based on 10 reviews"
Slide Type Slide • Exercise # 1: Define a class Point that represents a point in 2 – D plane. The point has x and y coordinates. Define the following: • A constructor to initialize the x, y coordinates. • A method translate(self, dx,dy) to translate the point object dx , and dy units in x and y directions, respectively. • A method distanceTo (self, point2) to return the distance between the point referenced by self and point2. • getX(self) to return the value of x coordinate. • getY(self) to return the value of y coordinate Test the above class by: • Creating 2 point objects; one with (3,5) as x,y coordinates; the second with (-10,30) as x,y coordinates. • Move the first point 5.5 units in x direction and -12.5 units in y direction using translate method • Find the distance between the 2 points in their current location using distance To method A Sample output resulting from running the above test class is shown below new coordinates of point1= (8.5 , -7.5) Coordinates of point 2 =…
please modify this: display method must call displayNormal   Window class abstract class Window implements GUIComponent {private int height, width;private boolean isThisVisible, minimized; public Window(int width, int height){this.height = height;this.width = width;} public int getHeight() {return height; } public int getWidth() {return width; } public String toString() { return "a " + width + "x" + height + " minimal window"; }public void resize(int width, int height){this.width = width;this.height = height;}public void display() {if (!isThisVisible) {System.out.println("(Nothing to see here)");}else if (!minimized) { System.out.println(".......................\n:" + toString() + ":\n.......................");} else {System.out.println("[" + this.toString() + " (minimized)]");} }public void minimize(){ minimized = true;} public void setVisible(boolean isThisVisible) { this.isThisVisible = isThisVisible; }public void restore(){ minimized=false;} public boolean isVisible() { return…

Chapter 12 Solutions

Starting Out with Java: From Control Structures through Data Structures (3rd Edition)

Ch. 12.3 - Prob. 12.11CPCh. 12.3 - Which layout manager arranges components in a row,...Ch. 12.3 - Prob. 12.13CPCh. 12.3 - Prob. 12.14CPCh. 12.3 - Prob. 12.15CPCh. 12.3 - Prob. 12.16CPCh. 12.3 - Prob. 12.17CPCh. 12.4 - Prob. 12.18CPCh. 12.4 - Prob. 12.19CPCh. 12.4 - Prob. 12.20CPCh. 12.4 - Prob. 12.21CPCh. 12.4 - Prob. 12.22CPCh. 12.4 - Prob. 12.23CPCh. 12.4 - Prob. 12.24CPCh. 12.4 - Prob. 12.25CPCh. 12.5 - Prob. 12.26CPCh. 12.5 - Prob. 12.27CPCh. 12 - With Swing, you use this class to create a frame....Ch. 12 - Prob. 2MCCh. 12 - Prob. 3MCCh. 12 - Prob. 4MCCh. 12 - Prob. 5MCCh. 12 - Prob. 6MCCh. 12 - Prob. 7MCCh. 12 - Prob. 8MCCh. 12 - Prob. 9MCCh. 12 - Prob. 10MCCh. 12 - Prob. 11MCCh. 12 - Prob. 12TFCh. 12 - Prob. 13TFCh. 12 - Prob. 14TFCh. 12 - Prob. 15TFCh. 12 - Prob. 16TFCh. 12 - Prob. 17TFCh. 12 - Prob. 18TFCh. 12 - Prob. 19TFCh. 12 - Prob. 20TFCh. 12 - The following statement is in a class that uses...Ch. 12 - Prob. 2FTECh. 12 - Prob. 3FTECh. 12 - Prob. 4FTECh. 12 - Prob. 5FTECh. 12 - Prob. 1AWCh. 12 - Prob. 2AWCh. 12 - The variable myWindow references a JFrame object....Ch. 12 - Prob. 4AWCh. 12 - Prob. 5AWCh. 12 - Prob. 6AWCh. 12 - Prob. 7AWCh. 12 - Prob. 8AWCh. 12 - Prob. 9AWCh. 12 - Prob. 1SACh. 12 - Prob. 2SACh. 12 - Prob. 3SACh. 12 - Prob. 4SACh. 12 - Retail Price Calculator Create a GUI application...Ch. 12 - Prob. 2PCCh. 12 - Prob. 3PCCh. 12 - Travel Expenses Create a GUI application that...Ch. 12 - Prob. 5PCCh. 12 - Joes Automotive Joes Automotive performs the...Ch. 12 - Prob. 8PC
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education