Results Panel

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page

Answer:

    heightGroup = new ButtonGroup();
    heightGroup.add( heightA );
    heightGroup.add( heightB );
    heightGroup.add( heightC );
    heightGroup.add( heightD );
    heightGroup.add( heightE );
    . . . . .
    heightPanel = new JPanel();
    . . . . .
    heightPanel.add( heightA );
    heightPanel.add( heightB );
    heightPanel.add( heightC );
    heightPanel.add( heightD );
    heightPanel.add( heightE );

Results Panel

Ideal Weight GUI

The remaining components are put into the resultPanel. There is no need for another button group.

  JTextField   resultText;
  JLabel       resultLabl;
  JPanel       resultPanel;
  . . .

  public IdealWeight()  
  {
    . . .
     
    // result panel
    resultText  = new JTextField(7);
    resultText.setEditable( false );   
    resultLabl  = new JLabel("Ideal Weight");
    resultPanel = new JPanel();
    resultPanel.add( resultLabl );
    resultPanel.add( resultText );
    . . .

QUESTION 6:

Examine the GUI display and identify the three panels, genderPanel, heightPanel, resultPanel.