So I'm trying to compile this program but I keep getting the error
Main.java:39: error: cannot find symbol
new Dashboard();
^
symbol: class Dashboard
location: class Main
1 error
I've tried looking at other similar posts trying out what they're doing but none of that worked for me. So I figured reinstalling my java installation would work (from jdk7 to jdk13), but I got the same results. I feel so stupid to ask what is probably a very easy oversight but I'm clueless. help me
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Main implements ActionListener {
private int clicks = 0;
private JLabel label = new JLabel("Number of clicks: 0 ");
private JFrame frame = new JFrame();
public void Dashboard() {
JButton button = new JButton("Click Me");
button.addActionListener(this);
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createEmptyBorder(30, 30, 10, 30));
panel.setLayout(new GridLayout(0, 1));
panel.add(button);
panel.add(label);
frame.add(panel, BorderLayout.CENTER);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("GUI");
frame.pack();
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
clicks++;
label.setText("Number of clicks: " + clicks);
}
public static void main(String[] args) {
new Dashboard();
}
}