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 );
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 ); . . .