title: JLabel not updating with SetText
body: <p>I'm a complete newbie to java, so this question may sound really dumb. My apologies for not being able to find an answer myself... I tried, but couldn't figure out what the issue is. :'(</p>
  <p><a href="https://i.stack.imgur.com/zQtxA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zQtxA.png" alt="enter image description here" /></a></p>
  <pre><code>public class ViewIncomePanel extends JPanel implements ActionListener {
  
  private HeadQuarter headQuarter;
  private JPanel viewIncomePanel;
  public static final String NAME = &quot;ViewIncomePanel&quot;;
  private JLabel amountMessage;
  private JLabel totalAmountMessage = new JLabel();
  private LoadCompletePanel loadCompletePanel;
  private MonthlyIncome monthlyIncome;
  private JButton backButton;
  private NumberFormat format = NumberFormat.getCurrencyInstance();
  
  public ViewIncomePanel(HeadQuarter userControl) {
      this.headQuarter = userControl;
      monthlyIncome = userControl.getMonthlyIncome();
      this.viewIncomePanel = this;
  
      JPanel incomePanel = new JPanel(new GridLayout(0, 1, 10, 10));
  
      double value = headQuarter.getTotalIncome();
      String s = Double.toString(value);
      amountMessage = new JLabel(&quot;Total amount is: &quot;);
      amountMessage.setAlignmentX(CENTER_ALIGNMENT);
      amountMessage.setAlignmentY(TOP_ALIGNMENT);
  
      totalAmountMessage.setText(s);
      totalAmountMessage.setAlignmentX(CENTER_ALIGNMENT);
      totalAmountMessage.setAlignmentY(TOP_ALIGNMENT);
  
  
      backButton = new JButton(&quot;Back&quot;);
      incomePanel.add(backButton);
      incomePanel.add(amountMessage);
      incomePanel.add(totalAmountMessage);
  
      backButton.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
              goBack();
          }
      });
  
      viewIncomePanel.add(incomePanel);
      incomePanel.setVisible(true);
  
  }
  
  private void goBack() {
      headQuarter.getScreen(loadCompletePanel.NAME);
  }
  </code></pre>
  <p>Here is my code. The issue is with totalAmountMessage; so for my code, every time I input an income the total amount of income should sum up. But my code always returns 0 when I run it. Funny thing is, when I tried printing out headQuarter.getTotalIncome() it worked fine. So the issue lies on getting the value printed with JLabel.</p>
  <p>Here is my MonthlyIncome class:</p>
  <pre><code>public class MonthlyIncome {
  
  private List&lt;CurrentIncome&gt; allIncome; // list of monthly income
  double total; // monthly total income
  double incomeDay;  // income for specified day
  
  public MonthlyIncome() {
      allIncome = new ArrayList&lt;&gt;();
  }
  
  public void addIncome(CurrentIncome i) {
      allIncome.add(i);
  }
  
  public void findIncomeDate(int date) {
      incomeDay = 0;
  
      for (CurrentIncome i : allIncome) {
          if (i.getDate() == date) {
              incomeDay += i.getIncome();
          }
      }
  }
  
  public double getIncomeForDate() {
      return incomeDay;
  }
  
  
  public double totalIncome() {
      total = 0;
  
      for (CurrentIncome d : allIncome) {
          total += d.getIncome();
      }
      return total;
  }
  
  public double getTotal() {
      return total;
  }
  </code></pre>
  <p>And here is my HeadQuarter class:</p>
  <pre><code>private MainGuiPanel mainGui;
  private double incomeAmount;
  private int incomeDate;
  private double expenditureAmount;
  private int expenditureDate;
  private ExpenditureType type;
  private CurrentExpenditure currentExpenditure;
  private MonthlyIncome monthlyIncome;
  private CurrentIncome currentIncome;
  
  
  public HeadQuarter(MainGuiPanel mainGui) {
      this.mainGui = mainGui;
      monthlyIncome = new MonthlyIncome();
  }
  
  public void getScreen(String name) {
      mainGui.getCardLayout().show(mainGui.getHolderPanel(), name);
  }
  
  public void addExpenditure(Double amount) {
      this.expenditureAmount = amount;
      currentExpenditure.setAmount(amount);
  }
  
  public MonthlyIncome getMonthlyIncome() {
      return monthlyIncome;
  }
  
  
  public void recordExpenditureDate(int date) {
      this.expenditureDate = date;
      currentExpenditure.setDate(date);
  }
  
  public void makeCurrentIncome(int date, double amount) {
      incomeAmount = amount;
      incomeDate = date;
      currentIncome = new CurrentIncome(incomeDate, incomeAmount);
      monthlyIncome.addIncome(currentIncome);
  }
  
  public void makeCurrentExpenditure(int date, double amount) {
      incomeAmount = amount;
      incomeDate = date;
      currentIncome = new CurrentIncome(incomeDate, incomeAmount);
      monthlyIncome.addIncome(currentIncome);
  }
  
  public double getTotalIncome() {
      return monthlyIncome.totalIncome();
  }
  </code></pre>
  <p>Any helps will be appreciated! Sorry again for asking such a stupid question. But I'll be really grateful if anyone can help me out!</p>