import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Menu extends JFrame { private JPanel pMain; private JButton bSet1; private JButton bSet4; private JButton bSet2; private JButton bSet3; private JButton bSet5; private JButton bTotal; public static Interface set1; public static Interface set2; public static Interface set3; public static Interface set4; public static Interface set5; public Menu() { add(pMain); setTitle("Stats Menu"); setSize(700,500); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); set1 = new Interface(false); set2 = new Interface(false); set3 = new Interface(false); set4 = new Interface(false); set5 = new Interface(false); Interface total = new Interface(true); bSet1.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { set1.setVisible(true); } }); bSet2.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { set2.setVisible(true); } }); bSet3.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { set3.setVisible(true); } }); bSet4.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { set4.setVisible(true); } }); bSet5.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { set5.setVisible(true); } }); bTotal.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { total.setVisible(true); } }); } public static JLabel[] getTotals(String stat) { JLabel[] a = new JLabel[13]; int s1; int s2; int s3; int s4; int s5; int tot; JLabel[] lab1 = new JLabel[13]; JLabel[] lab2 = new JLabel[13]; JLabel[] lab3 = new JLabel[13]; JLabel[] lab4 = new JLabel[13]; JLabel[] lab5 = new JLabel[13]; if (stat.equals("a")) { lab1 = set1.a; lab2 = set2.a; lab3 = set3.a; lab4 = set4.a; lab5 = set5.a; } else if (stat.equals("k")) { lab1 = set1.k; lab2 = set2.k; lab3 = set3.k; lab4 = set4.k; lab5 = set5.k; } else if (stat.equals("he")) { lab1 = set1.he; lab2 = set2.he; lab3 = set3.he; lab4 = set4.he; lab5 = set5.he; } else if (stat.equals("as")) { lab1 = set1.as; lab2 = set2.as; lab3 = set3.as; lab4 = set4.as; lab5 = set5.as; } else if (stat.equals("dc")) { lab1 = set1.dc; lab2 = set2.dc; lab3 = set3.dc; lab4 = set4.dc; lab5 = set5.dc; } else if (stat.equals("si")) { lab1 = set1.si; lab2 = set2.si; lab3 = set3.si; lab4 = set4.si; lab5 = set5.si; } else if (stat.equals("ac")) { lab1 = set1.ac; lab2 = set2.ac; lab3 = set3.ac; lab4 = set4.ac; lab5 = set5.ac; } else if (stat.equals("se")) { lab1 = set1.se; lab2 = set2.se; lab3 = set3.se; lab4 = set4.se; lab5 = set5.se; } else if (stat.equals("d")) { lab1 = set1.d; lab2 = set2.d; lab3 = set3.d; lab4 = set4.d; lab5 = set5.d; } else if (stat.equals("r")) { lab1 = set1.r; lab2 = set2.r; lab3 = set3.r; lab4 = set4.r; lab5 = set5.r; } else if (stat.equals("bs")) { lab1 = set1.bs; lab2 = set2.bs; lab3 = set3.bs; lab4 = set4.bs; lab5 = set5.bs; } else if (stat.equals("ba")) { lab1 = set1.ba; lab2 = set2.ba; lab3 = set3.ba; lab4 = set4.ba; lab5 = set5.ba; } else if (stat.equals("be")) { lab1 = set1.be; lab2 = set2.be; lab3 = set3.be; lab4 = set4.be; lab5 = set5.be; } for (int i=0; i < 13; i++) { a[i] = new JLabel("hi"); s1 = Integer.parseInt(lab1[i].getText()); s2 = Integer.parseInt(lab2[i].getText()); s3 = Integer.parseInt(lab3[i].getText()); s4 = Integer.parseInt(lab4[i].getText()); s5 = Integer.parseInt(lab5[i].getText()); tot = s1+s2+s3+s4+s5; a[i].setText("" + tot); } return a; } }