Completing ButtonTest
An instance of our ButtonPanel is created, and added to the content pane of the JFrame:
public static void main(String [] args) {
JFrame frame = new JFrame() ;
frame.setTitle(“ButtonTest”) ;
frame.setSize(450, 300) ;
frame.addWindowListener(new TerminationListener()) ;
frame.getContentPane().add(new ButtonPanel()) ;
frame.show() ;
}
Calling add(new ButtonPanel()) nests a ButtonPanel container inside the content pane container associated with the frame. Latter, recall, has border layout: can only directly hold a single component per “area”—here the central area.