Java Reference
In-Depth Information
In this case, the activate() method is the callback method that reactivates
the original LogonFrame window. The activate() method activates the object
associated with the Activator interface. LogonFrame, thus, implements the
Activator interface , which includes the activate() method and facilitates the
activation of an object from another object.
Figure 10-39 displays the code for the Activator interface containing the
abstract method, activate(). Later in the chapter, code for the LogonFrame class
will be developed to implement the Activator interface so that the LogonFrame
class can pass a reference of itself to the new StockFrame.
FIGURE 10-39
The following step enters code for the Activator interface.
To Create an Activator Interface
1. Create a new TextPad document and save it in the Chapter10 folder, or
a location specified by your instructor, typing Activator as the file
name and selecting Java (*.java) as the file type. Enter lines 1 through 12
as shown in Figure 10-39. In the comments, insert your own name as
programmer and enter the current date. Save and compile the Activator
interface.
TextPad displays code for the Activator interface (Figure 10-40). The inter-
face contains a single abstract method, activate(). The keyword, abstract, is
not required because all methods in an interface definition are abstract.
Activator
interface
abstract
method, activate()
FIGURE 10-40
Search WWH ::




Custom Search