java swing component cannot be resolved

前端 未结 9 2016
灰色年华
灰色年华 2020-12-11 16:43

I took the following code from a tutorial:

import javax.swing.*;
import java.util.Date;

public class SwingGUI {

    public static void main( String[] args          


        
9条回答
  •  -上瘾入骨i
    2020-12-11 16:57

    I faced the same issue and found that my project was using the Java 8 libraries. I installed the Java 7 library, added the same to the project properties by referencing the library from the installed C:\Program Files\Java folder and the error was gone.

    Looks like, the new Java 8 version may a different way to resolve the swing component.

提交回复
热议问题