Question
Windows on the desktop are just one of many objects used in a graphical user interface (GUI)-- buttons, drop-down list boxes, pop-up menus, are just
Windows on the desktop are just one of many objects used in a graphical user interface (GUI)-- buttons, drop-down list boxes, pop-up menus, are just some of the many others. Regardless of their particular appearance, tasks, and structure, all such GUI components share some common functionality-- which is handled in a manner unique to the actual component .
Define an interface, GUIComponent, with the following methods :
onClick-- void-returning and accepts a single integer parameter
onCursorFocus -- void-returning and accept no parameters
move -- 3 overloaded methods : both boolean -returning; one accepts a pair of integer parameters ; the second a singleparameter of type Position; the third a single parameter of type Dimension
resize-- 2 overloaded methods ; both boolean -returning; one accepts a pair of integer parameters ; the second a singleparameter of type Dimension
My Code:
interface GUIComponent{ public void onClick(int x); public void onCursorFocus(); public void onCursorFocus(int number1); public abstract boolean move(int number1, int number2); public abstract boolean move(Position position); public abstract boolean move(Dimension dimension); public abstract boolean resize(int number1, int number2); public abstract boolean resize(Dimension dimension); }
Errors:
We did not expect but found: in class GUIComponent: a public abstract method named resize returning a boolean and accepting a parameter of type Dimension. a public abstract method named onCursorFocus returning void and accepting no parameters.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started