I'm new to Java and have hit a wall with JButton. I am trying to do something so simple in other languages but I am getting the following message when I try to add a button to a frame.
The type javax.swing.JComponent cannot be resolved. It is indirectly referenced from required .class files.
Code is:
package testInput;
import javax.swing.*;
public class UserInput {
public static void main(String[] args) {
JFrame frame = new JFrame("Test");
frame.setSize(200,200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
JButton click = new JButton("Click");
frame.add(click);
}
}