I have written this program and I cannot get the GUI to show up. I cannot figure out what is wrong.
I appreciate any help guys.
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TestScores extends JFrame { private JLabel TestScoreLabel,TestWeightLabel; private JTextField TST1,TST2,TST3,TST4,TWT1,TWT2,TWT3,TWT4,TA; private JButton Calculate,Exit; private CalculateButtonHandler cbHandler; private ExitButtonHandler ebHandler; public void TestScoresProgram() { TestScoreLabel = new JLabel("Test Scores",SwingConstants.CENTER); TestWeightLabel = new JLabel("Test Weight",SwingConstants.CENTER); TST1 = new JTextField(10); TST2 = new JTextField(10); TST3 = new JTextField(10); TST4 = new JTextField(10); TWT1 = new JTextField(10); TWT2 = new JTextField(10); TWT3 = new JTextField(10); TWT4 = new JTextField(10); TA = new JTextField(20); Calculate = new JButton("Calculate"); cbHandler = new CalculateButtonHandler(); Calculate.addActionListener(cbHandler); Exit = new JButton("Exit"); ebHandler = new ExitButtonHandler(); Exit.addActionListener(ebHandler); setTitle("Test Average Calculater"); Container pane = getContentPane(); pane.setLayout(new GridLayout(7,2)); pane.add(TestScoreLabel); pane.add(TestWeightLabel); pane.add(TST1); pane.add(TWT1); pane.add(TST2); pane.add(TWT2); pane.add(TST3); pane.add(TWT3); pane.add(TST4); pane.add(TWT4); pane.add(TA); pane.add(Calculate); pane.add(Exit); pane.setSize(400,500); pane.setVisible(true); } private class CalculateButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { double TS1,TS2,TS3,TS4; double TW1,TW2,TW3,TW4,Ave; TS1 = Double.parseDouble(TST1.getText()); TS2 = Double.parseDouble(TST2.getText()); TS3 = Double.parseDouble(TST3.getText()); TS4 = Double.parseDouble(TST4.getText()); TW1 = Double.parseDouble(TWT1.getText()); TW2 = Double.parseDouble(TWT2.getText()); TW3 = Double.parseDouble(TWT3.getText()); TW4 = Double.parseDouble(TWT4.getText()); Ave = (TS1 * TW1) + (TS2 * TW2) + (TS3 * TW3) + (TS4 * TW4); TA.setText("Your test average is " + Ave); } } private class ExitButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { System.exit(0); } } public static void main(String[] args) { TestScores testObject = new TestScores(); } }