Unable to import javax.swing.JFrame
When you make a new java project at JRE choose "Use an execution environment JRE and from there select JavaSE-1.7 or 1.8 and just should solve the problem. I had the same problem like you before.
- Right-click on the project
- Select properties
- Java build path
- Library > Add Library > Add JRE SYSTEM Library
- Execution Environment
- Select JavaSE-1.7
- Finish
Just add requires java.desktop;
to your module-info.java file.
module-info.java:
module your_project_name{
requires java.desktop;
}