public class percentFatPan extends JFrame implements ActionListener { public percentFatPanel() { getContentPane().setLayout( new BoxLayout( getContentPane(), BoxLayout.Y_AXIS ); . . . . .
Two uses of getContentPane()
are needed to set
the layout manager:
getContentPane()
gets the content pane whose layout manager is to be set.getContentPane()
send a reference to the content pane to BoxLayout
.Now add the top label, the panels, and the button to the content pane:
Add the components from top to bottom