This is my program so far:
package allin1;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Allin1 {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
JButton b1 = new JButton("Exit");
public static void main(String[] args) {
panel.add(b1); //THIS IS THE PROBLEM??
}
}
The error I am getting from this is, "Non-static variable panel, cannot be referenced from a static context". I am not exactly clear what to do about this to be honest. I am fairly new to Java, and the whole static, public thing is beyond me truly.... Please help me with this!!