简体   繁体   English

无法导入 JFrame 或 Dimension

[英]Cannot import JFrame or Dimension

I already have the system library in my package and have tried resetting the metadata.我的包中已经有了系统库,并尝试重置元数据。 What else can I do?我还可以做些什么?

Errors with comments stating what errors they are.带有注释的错误说明它们是什么错误。

package JFrameTest;

import java.awt.Dimension; //The package java.awt is not accessible
import javax.swing.JFrame; //The type javax.swing.JFrame is not accessible

public class Empty extends JFrame { //JFrame cannot be resolved to a type

    public static void main (String[] args) {
        new Main().setVisible(true);  // Main cannot be resolved to a type
}

JavaFX was deleted from JDK, so you need to download JavaFX from here , here or use this guide. JavaFX 已从 JDK 中删除,因此您需要从此处此处或使用指南下载 JavaFX。 If you use maven just add the dependencies.如果您使用 maven,只需添加依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM