如何使用 Java 为 Windows 编写软件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3671079/
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
How to write software for Windows using Java?
提问by johngreen
I have just learned Java in my college. However, in that I can just write programs that are run in the command line. How can I create GUI softwares using Java, something like Notepad? I'm really sorry for asking such a basic question on this forum, but I am really interested in writing real-world software. Also, I've heard a lot about Python. How can I develop similar software using Python?
我刚刚在大学学习了 Java。但是,我只能编写在命令行中运行的程序。如何使用 Java 创建 GUI 软件,例如记事本?我真的很抱歉在这个论坛上提出这样一个基本的问题,但我真的对编写真实世界的软件很感兴趣。另外,我听说过很多关于 Python 的事情。如何使用 Python 开发类似的软件?
采纳答案by Leniel Maccaferri
You can use Eclipseto develop Java GUI/desktop applications for Windows.
您可以使用Eclipse为 Windows 开发 Java GUI/桌面应用程序。
http://www.eclipse.org/downloads/
http://www.eclipse.org/downloads/
NetBeansis also an option.
NetBeans也是一种选择。
For Python, check these links:
对于 Python,请查看以下链接:
回答by Bart Kiers
Java: Trail: Creating a GUI With JFC/Swing
Java:Trail:使用 JFC/Swing 创建 GUI
Python: GUI Programming in Python
Python:Python 中的GUI 编程
And since you mentioned creating a simple text editor, here'san example.
既然你提到创建一个简单的文本编辑器,这里有一个例子。
回答by Andre Holzner
Start by using an integrated development environment such as Eclipseor Netbeans. Both of them are free.
首先使用集成开发环境,例如Eclipse或Netbeans。两者都是免费的。
Both have visual editors to graphically design your program and assist you writing the actions performed in the code when you e.g. click a button or so. Personally I prefer Netbeans for this purpose as the gui designer does not need to be added as an optional plugin (maybe this is also not necessary any more for Eclipse).
两者都有可视化编辑器来以图形方式设计您的程序并帮助您编写在代码中执行的操作,例如单击按钮等。就我个人而言,我更喜欢 Netbeans,因为 gui 设计器不需要作为可选插件添加(也许这对于 Eclipse 来说也不再需要了)。
Of course, to go beyond the first steps, you will need to read some documentation on how to build GUIs as suggested in other answers.
当然,为了超越第一步,您需要阅读一些有关如何按照其他答案中的建议构建 GUI 的文档。
回答by Albert
If your goal is to write native windows apps you might also consider switching to .Net (c#) which is not too hard to learn when you know programming basics in java.
如果您的目标是编写本机 Windows 应用程序,您还可以考虑切换到 .Net (c#),当您了解 Java 编程基础知识时,这并不难学。
.net is much better integrated in the windows environment and I think visual studio has a notepad example lying around somewhere.
.net 更好地集成到 Windows 环境中,我认为 Visual Studio 有一个记事本示例位于某处。
Not saying you can't do this in java, sure you can.
并不是说你不能在 Java 中做到这一点,当然可以。
回答by gkaykck
Use netbeans, it has a old but good visual development mode. I cannot remember perfectly but it uses swing library i guess. Also it lets you develop not for only windows, but for mobile phones etc if you install the right plugin.
使用netbeans,它有一个古老但很好的可视化开发模式。我记不清了,但我猜它使用了swing库。此外,如果您安装了正确的插件,它不仅可以让您为 Windows 开发,还可以为手机等开发。
回答by Nauman Khalid
i think for beginners netbean is good because its interface is user friendly. it manages the code in well define manner and make code easy to understand
我认为对于初学者来说,netbean 很好,因为它的界面是用户友好的。它以明确定义的方式管理代码并使代码易于理解
回答by Alex
You can use IntelliJ: https://www.jetbrains.com/idea/
您可以使用 IntelliJ:https: //www.jetbrains.com/idea/
This is a very good Java IDE if you want to become, going to become, or are already a developer.
如果您想成为、即将成为或已经成为开发人员,这是一个非常好的 Java IDE。