Add the Panels to the Relative Panels

Add a panel for the dice row and a score panel to the main panel, add a round and score panel to the Score Panel and add a points panel to the dice row panel.

What is box layout and combined layouts?

A box layout arranges components into a single row or column. By combining panels with different box layout options, you can arrange components in complex ways.

A box layout may stretch some components to fill the width or height of the panel.

Adding main panels and buttons to the window

Greedy must keep track of points, scores, and rounds. Create instance variables for these values so they may be used by different methods.

  1. Add private integer instance variables called points, newPoints, score, and round. Initialize all values to 0 except round. Initialize round to 1.
  2. Add private JLabel instance variables called pointsLabel, scoreLabel, and roundLabel. Initialize each by calling JLabel’s constructor. Each of these labels should have an initial text of “0”, except roundLabel, which should have an initial text of “1”.
    ...
 
  private static final long serialVersionUID = 1L;
  
  _______________ points = ____;
  _______________ newPoints = ____;
  _______________ score = ____;
  _______________ round = ____;
  _______________ pointsLabel = _______________;
  _______________ scoreLabel = _______________;
  _______________ roundLabel = _______________;  
 
    ...

Get hands-on with 1200+ tech skills courses.