与 C# 的 Windows 窗体等效的用于轻松快速地构建 GUI 应用程序的 Java 是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/952317/
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-06 04:06:19  来源:igfitidea点击:

What is the Java equivalent to C#'s Windows Forms for building GUI apps easily and rapidly

c#javawinformside

提问by JimDel

I wanted to learn to program and looked at both Java and C#. I decided to go with C# because it was so easy to just open a form and plop some buttons and text boxes on it. With just one download, C# Express got me going.

我想学习编程并同时研究 Java 和 C#。我决定使用 C#,因为它很容易打开一个表单并在上面放置一些按钮和文本框。只需下载一次,C# Express 就让我开始了。

From what I saw with Java that couldn't be done. At least not without downloading and configuring other software. All of which I found no easy instructions for. But I really wanted to learn Java.

从我所看到的 Java 无法完成。至少在没有下载和配置其他软件的情况下不能。我发现所有这些都没有简单的说明。但我真的很想学习Java。

I really don't want to learn how to create UIs AND a new language. I'd rather just to concentrate on the code itself. Is there an easy way (like C# basically) to create Java apps?

我真的不想学习如何创建 UI 和一门新语言。我宁愿只专注于代码本身。有没有一种简单的方法(基本上像 C#)来创建 Java 应用程序?

采纳答案by z -

Are you talking about a GUI builder?

您是在谈论 GUI 构建器吗?

There are many GUI builders out there. Some IDEs like Netbeanscome with nice GUI buildersfor Java.

有许多 GUI 构建器。一些像Netbeans这样的 IDE带有很好的 Java GUI 构建器

回答by alt_tab

There are options in the Java community for 'one-stop downloads' like you mention. They are out there, they're just not as public as Visual Studio is. EasyEclipseis one of my favorites.

Java 社区中有您提到的“一站式下载”选项。它们就在那里,只是不像 Visual Studio 那样公开。EasyEclipse是我的最爱之一。

回答by dreadwail

The ability to learn to program in one language or another should most certainly not be based upon how to drag and drop GUI controls, especially since that measure is irrelevant to the language itself.

学习用一种或另一种语言编程的能力肯定不应该基于如何拖放 GUI 控件,尤其是因为该度量与语言本身无关。

Side note: Java and C# are so similar that you'll pretty much be learning both as you go regardless.

旁注:Java 和 C# 非常相似,无论如何,您几乎都会同时学习两者。

回答by OscarRyz

It seems to me the best and easier way to get what you want is to use Netbeans(JDK 6u14 with NetBeans IDE 6.5.1 Bundle).

在我看来,获得您想要的最好和更简单的方法是使用Netbeans (JDK 6u14 和 NetBeans IDE 6.5.1 Bundle)。

It has both the JDK and the IDE in one download. And it has a easy and very good GUI builder.

它在一次下载中同时包含 JDK 和 IDE。它有一个简单且非常好的 GUI 构建器。

Java is a very good platform and as you said it is easier to create cross platform applications, however, don't except this from the Desktop UI which, although still cross platform, not always gets right on all platforms with out modification.

Java 是一个非常好的平台,正如您所说,创建跨平台应用程序更容易,但是,不要从桌面 UI 中排除这一点,尽管它仍然是跨平台的,但并不总是在所有平台上都正确而无需修改。

You would have to add some code specific for each target desktop, but definitely that's a lot easier than write three different application ( One in Visual C#, other in GTK, and other in Cocoa )

您必须为每个目标桌面添加一些特定的代码,但这肯定比编写三个不同的应用程序(一个在 Visual C# 中,另一个在 GTK 中,另一个在 Cocoa 中)容易得多

回答by Ryan Thames

Using Netbeans, you can create Java based Swing GUIs pretty easily. Netbeans comes with a pretty nice GUI builder.

使用 Netbeans,您可以非常轻松地创建基于 Java 的 Swing GUI。Netbeans 带有一个非常好的 GUI 构建器。

If you learn how to program in Java, I don't think it would really be that much of a stretch to create Java Swing applications from scratch. It's just a matter of learning the Swing libraries.

如果您学习了如何用 Java 编程,我认为从头开始创建 Java Swing 应用程序真的不会那么费力。这只是学习 Swing 库的问题。

Not being from a .NET background, I can't comment on learning C# GUIs, but from my experience Swing was very easy to learn and it helps A LOT to understand the code underlying what the GUI builder in Netbeans generates.

不是来自 .NET 背景,我无法评论学习 C# GUI,但根据我的经验,Swing 非常容易学习,它有助于理解 Netbeans 中 GUI 构建器生成的底层代码。

回答by Thorbj?rn Ravn Andersen

If you have Java in your browser, all you need is the latest Eclipse bundle.

如果您的浏览器中有 Java,那么您所需要的只是最新的 Eclipse 包。

I would suggest the Java EE edition for your platform from http://www.eclipse.org/downloads/

我会从http://www.eclipse.org/downloads/为您的平台推荐 Java EE 版本

It appears that there are video tutorials starting from scratch at http://eclipsetutorial.sourceforge.net/totalbeginner.html

似乎有视频教程从头开始http://eclipsetutorial.sourceforge.net/totalbeginner.html

回答by Peter Lawrey

I decided to go with C# because it was so easy to just open a form and plop some buttons and text boxes on it.

我决定使用 C#,因为它很容易打开一个表单并在上面放置一些按钮和文本框。

You can do this using builders in either language without writing any code.

您可以使用任何一种语言的构建器来完成此操作,而无需编写任何代码。

With just one download, C# Express got me going.

只需下载一次,C# Express 就让我开始了。

Netbeans is the same deal for Java.

Netbeans 对 Java 来说也是一样。

From what I saw with Java that couldn't be done. At least not with out downloading and configuring other software.

从我所看到的 Java 无法完成。至少不用下载和配置其他软件。

True, you cannot develop Java with C# Express and you cannot develop in c~ using Netbeans. You do need to install two pieces of software.

确实,您不能使用 C# Express 开发 Java,也不能使用 Netbeans 在 c~ 中进行开发。您确实需要安装两个软件。

All of which I found no easy instructions for.

我发现所有这些都没有简单的说明。

I suggest you try http://www.google.co.uk/search?q=netbeans+gui+builder+tutorials55,100 hits or http://www.google.co.uk/search?q=java+gui+tutorials1,340,000 hits

我建议您尝试http://www.google.co.uk/search?q=netbeans+gui+builder+tutorials55,100 次点击或http://www.google.co.uk/search?q=java+gui+教程1,340,000 次点击

But I really wanted to learn Java.

但我真的很想学习Java。

It doesn't appear you want to actually write any code or install more than one program at a time. You will find that learning to program in a language will be asking more from you than this.

看起来您并不想实际编写任何代码或一次安装多个程序。你会发现学习编程语言对你的要求远不止这些。

Was I missing something?

我错过了什么吗?

Quite a bit I imagine.

我想象的有点多。

I really don't want to have to learn how to create UI's AND a new language.

我真的不想学习如何创建 UI 和一种新语言。

You can use a GUI builder to layout your windows, but if you want your program to do something useful, you will have to do some programing in a language.

您可以使用 GUI 构建器来布局您的窗口,但是如果您希望您的程序做一些有用的事情,您将不得不使用某种语言进行一些编程。

I'd rather just want to concentrate on the code itself.

我宁愿只想专注于代码本身。

That appears to contradict everything you have just said. You can't concentrate on the code without learning the language.

这似乎与你刚才所说的一切相矛盾。不学习语言就无法专注于代码。

Is there an easy way (like C# basically) to create Java apps?

有没有一种简单的方法(基本上像 C#)来创建 Java 应用程序?

To write apps that do something useful you are going to have to learn how to program and at least one language. I suggest you also learn how to debug and profile your program.

要编写有用的应用程序,您将必须学习如何编程和至少一种语言。我建议您还学习如何调试和分析您的程序。

回答by Kevin

I'd have to agree with dxmio, I switch back and forth between c# and java quite often. The two languages are quite similar.

我不得不同意 dxmio,我经常在 c# 和 java 之间来回切换。这两种语言非常相似。

回答by Zen

I been learning to program in C# for a few months, but recently I signed up for a course which required Java. So I started playing around with java, first tried Netbeans then Eclipse.

我已经学习了几个月的 C# 编程,但最近我报名参加了一门需要 Java 的课程。所以我开始玩 Java,首先尝试 Netbeans,然后尝试 Eclipse。

I'm kinda a computer programming noobie (background mainly in web design) so take my perspective as a student. After messing around with Java for a bit i still prefer C#. While both are excellent the factors that tipped C# in my case are as follows

我有点像一个计算机编程新手(背景主要是网页设计)所以以我作为学生的角度来看。在与 Java 混了一段时间之后,我仍然更喜欢 C#。虽然两者都很出色,但在我的情况下,C# 的因素如下

  1. Easier documentation and a large variety of easy to view Video Tutorials, yes I know netbeans have a very large collection of video tutorials as well, they are encoded at such a terrible resolution and bitrate that they are largely unwatchable
  2. Slightly easier to learn, maybe it's cause of the IDE or the syntax, but I found C# easier to pick up.
  3. More functionality exposed right after using the IDE, you will find more controls in visual studio than compared to Netbeans. Eclipse was quite confusing for a noobie like me wading through it's massive plugins.
  1. 更简单的文档和各种易于查看的视频教程,是的,我知道 netbeans 也有大量的视频教程,它们以如此糟糕的分辨率和比特率进行编码,以至于基本上无法观看
  2. 稍微容易学习,也许是 IDE 或语法的原因,但我发现 C# 更容易上手。
  3. 使用 IDE 后立即公开更多功能,与 Netbeans 相比,您会在 Visual Studio 中找到更多控件。对于像我这样浏览大量插件的菜鸟来说,Eclipse 非常令人困惑。

I think the only thing java has going for it, is that it's supported on more platforms. Though Mono is making up for the linux and Apple side so i guess it's not that bad. Either way they are both extremely productive environments, just in my humble noobie opninion C# is just slightly more intuitive to pick up.

我认为java唯一要做的就是在更多平台上支持它。虽然 Mono 弥补了 linux 和 Apple 方面的不足,但我想它并没有那么糟糕。无论哪种方式,它们都是非常高效的环境,只是在我不起眼的菜鸟意见中,C# 更直观一些。

回答by davek

I've done a fair bit of work (> 4 years) on both platforms and the biggest difference I have found is not so much with the languages per se, but with the whole development environment. Specifically:

我在两个平台上都做了相当多的工作(> 4 年),我发现最大的区别不是语言本身,而是整个开发环境。具体来说:

  1. In .Net (be it ASP.Net, C# or VB.Net) the examples you find on MSDN or elsewhere tend to just workwithout a whole lot of tweaking, and the documentation is more reliable, whereas Java examples - especially the open source ones - often don't work out of the box and the documentation (yes, Apache Slide and Shindig - I'm looking at YOU!) is sometimes non-existent.

  2. Having said that, the sheer amount of choice for plugins, libraries and the like for the Java platform is enormous, which is unsurprising considering its (largely) non-proprietary nature.

  1. 在 .Net(无论是 ASP.Net、C# 还是 VB.Net)中,您在 MSDN 或其他地方找到的示例往往无需进行大量调整即可工作,并且文档更可靠,而 Java 示例——尤其是开源示例那些 - 通常不是开箱即用的,并且文档(是的,Apache Slide 和 Shindig - 我在看着你!)有时不存在。

  2. 话虽如此,Java 平台的插件、库等选择的数量是巨大的,考虑到其(主要)非专有性质,这并不奇怪。