29.9k views
3 votes
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 accepts a single integer parameter
move -- 3 overloaded methods: all boolean-returning; one accepts a pair of integer parameters; the second a single parameter of type Position; the third a single parameter of type Dimension
resize-- boolean-returning and accepts a pair of integer parameters

User Gladia
by
4.6k points

1 Answer

1 vote

Answer:

The GUI component is defined as follows

abstract interface GUIComponent {

public abstract void onClick(int a);

public abstract void onCursorFocus(int a);

public abstract boolean move(int a, int b);

public abstract boolean move(Position a);

public abstract boolean move(Dimension a);

public abstract boolean resize(int a, int b);

}

Step-by-step explanation:

Here the first line is the definition of the interface GUIComponent with the type abstract.

The second line is the public abstract with no return onClick function for int a.

The third line is the public abstract with no return onClickFocus function for int a.

The fourth line is the public abstract with boolean return moving the cursor to int a and int b.

The fifth line is the public abstract with boolean return moving the cursor to Position a.

The sixth line is the public abstract with boolean return dimensioning the cursor to Position a.

The seventh line is the public abstract with boolean return resizing to int a and int b.

User Noell
by
5.4k points