1 Reply Latest reply: Aug 4, 2011 9:55 AM by morgalr RSS

    what should i add to my project

      import javax.swing.*;

      import java.awt.*;
      import java.awt.event.*;

      public class TestBudgetCalculator extends BudgetCalculator implements ActionListener {
                     private JButton jbSetMonthlySalary= new JButton("Set");
                     private JLabel jlabelSalary = new JLabel("Monthly Salary");
                     private JLabel jlabellimits = new JLabel("Spending Limits");
                     private JLabel jlabelmyFood = new JLabel("Food");
                     private JLabel jlabelmyEntertainment = new JLabel("Entertainment");
                     private JLabel jlabelmyMisc = new JLabel("Misc");
                     private JLabel jlabelmySavings = new JLabel("Savings");
                     private JTextField jtextMonthlySalary = new JTextField("");
                     private JTextField jtextmyFood = new JTextField("");
                     private JTextField jtextmyEntertainment = new JTextField("");
                     private JTextField jtextmyMisc = new JTextField("");
                     private JTextField jtextmySavings = new JTextField("");

                     public TestBudgetCalculator(){
                          BorderLayout b = new BorderLayout();
                          setLayout(b) ;

                          JPanel p = new JPanel();
                          JPanel p1 = new JPanel();
                          JPanel p2 = new JPanel();
                          JPanel p3 = new JPanel();
                          p1.setLayout(new GridLayout(1,2));
                          p2.setLayout(new GridLayout(4,1));
                          p3.setLayout(new GridLayout(1,2));
                          p2.add(jtextmySavings );
                          add(p1, BorderLayout.NORTH);
                          add(p3, BorderLayout.CENTER);
                          public static void main(String[] args){
                               TestBudgetCalculator frame = new TestBudgetCalculator();
                          public void actionPerformed(ActionEvent e) {
                               if (e.getSource()==jbSetMonthlySalary){
                               double MSalary = Double.parseDouble(jtextMonthlySalary.getText());
                               BudgetCalculator setmysalary = new BudgetCalculator();
                               BudgetCalculator salary = new BudgetCalculator();
      there is still one more class file that i haven't added here.this is the test class. im suppose to input my salary to calculate food,entertainment,misc and savings. what codes should i add? to make the calculation?