import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class JudgingGUI extends JFrame { private JLabel [] judgeName; private JTextField [] judgeScore; private JLabel contestantName; private JTextField name; private JButton computeScore; private JButton reset; private JLabel scoreLabel; private JTextField totalScore; private judging judges; int n=8; private final int FRAME_WIDTH = 450; private final int FRAME_HEIGHT = 200; public JudgingGUI(int n){ super("Judging Scores"); setSize(FRAME_WIDTH,FRAME_HEIGHT); setLayout(new FlowLayout()); contestantName = new JLabel ("Contestant Name: "); //contestantName.setHorizontalAlignment(SwingConstants.CENTER); add(contestantName); name = new JTextField(20); //name.setHorizontalAlignment(SwingConstants.CENTER); add(name); judgeName = new JLabel[n]; for (int i=0; i < n; i++){ judgeName[i] = new JLabel ("Judge " + (i+1)); add(judgeName[i]); } judgeScore = new JTextField[n]; for (int j=0; j 10 || scores[i] < 1 ){ JOptionPane.showMessageDialog(null, "The score entered for Judge " + (i+1) + " was not a number bewteen 1 and 10. Try again."); continue; } } judging.setScores(scores); judging.calculateScore(); double result = judging.getScores(); } } private class ResetHandler implements ActionListener{ public void actionPerformed(ActionEvent e){ } } }