我们可以在 swing 中开发非常漂亮的 UI吗?如果不能的话有什么替代方案

发布于 2024-09-03 10:48:17 字数 189 浏览 3 评论 0原文

在我当前的项目中,我们必须用 java 开发一个漂亮的基于桌面的应用程序。

目前,我们有一个用 swing 编写的非常基本的桌面应用程序,并且团队没有很好的 swing 知识。我们能在 swing 中创建一个非常好看的 UI 吗?

我们应该使用 JavaFX 来创建桌面应用程序吗?

还有什么其他选择可以做到这一点?

In my current project we have to develop a good looking desktop based application in java.

Currently, we have a very basic desktop application written in swing and team does not have good swing knowledge. Can we create a very good looking UI in swing?

Should we use JavaFX for creating the desktop application?

What are other alternatives to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

旧伤还要旧人安 2024-09-10 10:48:17

Swing 在外观和感觉方面非常灵活,您当然可以使用 Swing 制作非常漂亮的应用程序。

如果您愿意,我推荐 Chet Haase 和 Romain Guy 的肮脏的富客户一书学习如何制作漂亮的 Swing GUI 应用程序。

Swing is very flexible with regards to look-and-feel and you can certainly make very good looking applications with Swing.

I recommend the book Filthy Rich Clients by Chet Haase and Romain Guy if you want to learn how to make nice Swing GUI applications.

寒冷纷飞旳雪 2024-09-10 10:48:17

你可以让它看起来像你想要的那样。特别是如果你写下自己的外观和感觉。我自己用半透明面板和简单的按钮完成了它。

查看屏幕截图:

http://www.taranfx.com/best-java-swing-look-and-feel-themes-professional-casual-top-10

Nimbus 是一种新的外观和感觉,越来越受欢迎,而且在我看来它看起来非常专业:

在此处输入图像描述

You can make it look just about however you want. Especially if you write up your own look and feel. I've done it myself with semi-transparent panels and simplistic buttons.

Have a look at the screen shots at:

http://www.taranfx.com/best-java-swing-look-and-feel-themes-professional-casual-top-10

Nimbus is a new look and feel which is gaining popularity, and it looks very professional imo:

enter image description here

临走之时 2024-09-10 10:48:17

查看推送像素。 Kirill 是 Substance 的作者,它为 Swing 提供了大量新的外观选项。 这里 是一篇博客文章,其中展示了 Swing 的一些功能。曾经有一个链接指向他 2007 年在 Java One 上的演讲,但不幸的是该链接不再有效。

Check out pushing-pixels. Kirill is the author of Substance which provides a ton of new look and feel options for Swing. Here's a blog entry which shows a little bit of what is possible with Swing. There used to be a link to his 2007 presentation at Java One, but unfortunately the link no longer works.

望喜 2024-09-10 10:48:17

您当然可以在 Swing 中创建美观的 UI - 应用程序,例如 NetBeansIntelliJ IDEA 已经证明了这一点。

Swing 唯一的替代方案是 SWT(Eclipses 工具包),但是它不像 Swing 那样可移植,也不像 Swing 那样灵活以及。然而,它提供了更快的性能和本机组件的使用,这可能是一些人真正想要的。

大多数现有 GUI 工具包也有 Java 绑定 - 例如 Java for Gnome,有人可能会找到它们有趣的。

然而,我喜欢 Swing 的极端可移植性、MVC 采用、可插拔的外观和感觉、许多带有附加组件的第三方库的可用性( SwingXJIDE、...)和易用性。

顺便说一句,为了在 Swing 中获得最佳结果,选择一个好的布局管理器至关重要 - 我建议您看看全能的 MiG 布局。

You can certainly create great looking UI's in Swing - applications such as NetBeans and IntelliJ IDEA have proved this amongst many others.

The only alternative Swing has is SWT(Eclipses toolkit), however it's not portable as Swing and not as flexible as well. It offers, however, faster performance and the use of native components, which might be what some people actually want.

There are Java bindings for most existing GUI toolkits as well - for example Java for Gnome and someone might find them interesting.

I however favour Swing's extreme portability, MVC adoption, pluggable look and feels, availability of lots of third party libraries with additional components(SwingX, JIDE, ...) and ease of use.

Btw for optimal results in Swing, choosing a good layout manager is essential - I recommend you to have a look at the almighty MiG layout.

你的背包 2024-09-10 10:48:17

不要用棒子碰 JavaFX 1。

然而,JavaFX 2 看起来非常有前途,Oracle 表示他们将把它紧密地集成到 Java 8 中。它背后有一个非常好的 API,它以图形方式加速,您可以使用 CSS3 随意设置它的外观,默认情况下它是这样的看起来也很不错。

唯一需要注意的是,它还不适用于 Linux - 但如果您希望开发一个将在未来几年左右发布的应用程序,或者您不太担心等待跨平台支持,这是一个值得考虑的好选择。

Don't touch JavaFX 1 with a bargepole.

JavaFX 2 however looks very promising, with Oracle saying they're going to integrate it tightly to Java 8. It's got a very nice API behind it, it's graphically accelerated, you can skin it pretty much how you please using CSS3 and by default it looks pretty nice too.

Only caveat is that it's not available for Linux yet at all - but if you're looking to develop an application that's going to be released in the next couple of years or so, or you're not too fussed about waiting for cross platform support, it's a good option to consider.

手心的温暖 2024-09-10 10:48:17

从你的回答来看,不太清楚你的问题是什么。一个简单但通常足够的解决方案是将应用程序的外观更改为系统默认的外观(因此 Swing 看起来就像本机应用程序)。您需要做的就是在创建/显示任何 UI 之前插入以下代码(如果您不知道在哪里,请将其作为主方法中的第一个):

try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
// exit application, log  or ignore exception
}

From you answer its not very clear what your problem is. A simple, but often sufficent solution is to change the look and feel for you application to the Systems default look an feel (so Swing looks just like a native application). All you need to do is insert the following code somewhere before any of your UI is created/shown (if you don't know where, place it as the first in your main-method):

try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
// exit application, log  or ignore exception
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文