使用 Eclipse 编程 Java GUI

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24557794/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 12:58:59  来源:igfitidea点击:

Programming Java GUI with Eclipse

javaeclipsecomponentsruntime-errorinstallation-package

提问by user3802248

Everyone I recently installed java JDK. However, I am not able to program GUI applications. For instance when i want to program anything from "swing" components i cannot include Buttons, Labels, Text, etc.

我最近安装了java JDK。但是,我无法编写 GUI 应用程序。例如,当我想从“swing”组件中编程任何东西时,我不能包括按钮、标签、文本等。

As a developing tool I am using Eclipse.

作为开发工具,我使用 Eclipse。

Can someone tell me if I am missing something.

有人可以告诉我是否遗漏了什么。

回答by TameHog

Eclipse doesn't come with default UI editing tools. You have to install extra plugins to get that sort of UI. Eclipse WindowBuilderis the best plugin I find to create a Swing UI.

Eclipse 不附带默认的 UI 编辑工具。你必须安装额外的插件才能获得那种 UI。Eclipse WindowBuilder是我发现的用于创建 Swing UI 的最佳插件。

回答by quartaela

Use NetBeanswhich has the best GUI tool.

使用具有最佳 GUI 工具的NetBeans

回答by user3761347

I am not sure if your problem is same as the one I got. If your error shows "Access Restriction: The type is not accessible due to restriction on library" then you have to Right click your project-> Properties-> Java build path -> Libraries -> Remove the JRE System Library-> Click add library-> add back the JRE system library, then the error will goes off.

我不确定您的问题是否与我遇到的问题相同。如果您的错误显示“访问限制:由于库的限制,类型无法访问”,那么您必须右键单击您的项目-> 属性-> Java 构建路径-> 库-> 删除 JRE 系统库-> 单击添加库-> 重新添加 JRE 系统库,然后错误就会消失。