Java Reference
In-Depth Information
Line 138 adds the Action Listener to the Submit button. Recall that the
addActionListener() method is necessary for the program to listen for the user's
mouse click and to trigger the appropriate event. The following step adds the
components to the JFrame.
To Add the Components to the JFrame
1. Enter the code from Figure 8-16, lines 92 through 138.
TextPad displays the add() methods (Figure 8-17). The fieldPanel is added
to the Center region, and the buttonPanel is added to the South region.
components added
to panels
panels added to BorderLayout
Action Listener assigned
FIGURE 8-17
 
Search WWH ::




Custom Search