I am trying to create an application which will increment the month in a LocalDateTime object when a button is pressed.

The LocalDateTime object and JLabel displaying the month name is stored in the Main class which extends JFrame.

The JButton which has an ActionListener, incrementing the month of the LocalDateTime object by 1 when it is pressed, is stored in a separate class called Panel1 which extends JPanel.

The Panel1 class is added to the JFrame. What should I do to make it so that the JLabel will reflect the changes made to the LocalDateTime object when the button is pressed?

Main Class:

```
import javax.swing.*;
import java.awt.*;
import java.time.LocalDateTime;

public class Main extends JFrame {

    private LocalDateTime currentTime = LocalDateTime.now();
    private JLabel monthLabel;

    public Main() {
        super();
        setLayout(new BorderLayout());
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

        monthLabel = new JLabel(currentTime.getMonth().name());

        add(monthLabel, BorderLayout.NORTH);
        add(new Panel1(currentTime), BorderLayout.SOUTH);

        pack();
        setVisible(true);
    }

    public static void main(String args[]) {
        Main main = new Main();
    }

}

```

Panel1 Class:

```
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.time.LocalDateTime;

public class Panel1 extends JPanel implements ActionListener {

    private LocalDateTime time;
    private JButton incrementMonth;

    public Panel1(LocalDateTime time) {
        this.time = time;

        incrementMonth = new JButton(">");
        incrementMonth.addActionListener(this);
        add(incrementMonth);
    }

    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == incrementMonth) {
            time = time.plusMonths(1);
        }
    }

}

```