是否可以使用 JavaFX 和 Swing 制作具有视觉吸引力的 GUI?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2817540/
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
Is it possible to make a visually appealing GUI with JavaFX & Swing?
提问by amirouche
I would like to do a visually appealing / user-friendly GUI in java. Swing is a limited in terms of "skin" customization. I'm thinking about JavaFX, but I don't get it yet,
我想用 java 做一个视觉上吸引人/用户友好的 GUI。Swing 在“皮肤”定制方面是有限的。我在考虑 JavaFX,但我还不明白,
- what can I achieve with this technology ?
- how hard is it ?
- do you have examples of real-life examples of Swing/JavaFX integration ?
- 我可以用这项技术实现什么?
- 有多难?
- 你有 Swing/JavaFX 集成的真实例子吗?
I would like to do something in this spirit of this, which is built on the .NET framework:
我想本着这种精神做一些事情,它建立在 .NET 框架之上:
original link: http://www.patrickpayet.com/net/?p=329edit: is their any getting started overview sample code that I can read to get a general feeling of the work needed to be done to achieve something in the spirit of the screenshot? maybe something like the miglayout's swing demo http://www.migcalendar.com/miglayout/swingdemoapp.jnlp
原始链接:http: //www.patrickpayet.com/net/? p = 329 编辑:他们是否有任何入门概述示例代码,我可以阅读这些代码以大致了解在截图的精神?也许像 miglayout 的摇摆演示http://www.migcalendar.com/miglayout/swingdemoapp.jnlp
edit2: I found http://download.java.net/general/openjfx/demos/tutorial.jnlpit's really basic though, linked from http://www.deitel.com/ResourceCenters/Programming/JavaFX/JavaFXTutorialsandDemos/tabid/2187/Default.aspx
edit2:我发现http://download.java.net/general/openjfx/demos/tutorial.jnlp虽然它非常基本,但链接自http://www.deitel.com/ResourceCenters/Programming/JavaFX/JavaFXTutorialsandDemos/tabid/ 2187/默认.aspx
采纳答案by Riduidel
Doing such a GUI with JavaFX seems to be rather easy.
用 JavaFX 做这样的 GUI 似乎相当容易。
For a rapid view on the JavaFX echosystem, I would suggest you to take a look at those sites, showing most of the bleeding edge JavaFX technologies :
要快速了解 JavaFX 回声系统,我建议您查看这些站点,其中展示了大多数最前沿的 JavaFX 技术:
- Jonathan Giles blogon Swing/JavaFX/Griffon
- Dean Iverson bloggoing more in details about JavaFX components
- Amy Fowler blog
- And finally, take a look at JavaFX home sitesamples.
- Jonathan Giles关于 Swing/JavaFX/Griffon 的博客
- Dean Iverson 博客详细介绍了 JavaFX 组件
- 艾米福勒博客
- 最后,看看JavaFX 主站点示例。
回答by Jonas
Yes, Swing is very customizable. I recommend reading Filthy Rich Clients.
是的,Swing 是非常可定制的。我推荐阅读肮脏的富客户。
For an example, have a look at Cezanne L&F.
例如,看看Cezanne L&F。
回答by Xavier Young
Swing's L&F can help you in this case.
在这种情况下,Swing 的 L&F 可以为您提供帮助。
The traditional way to customize L&F is to write your own UI classes for all components, which is not easy.
传统的自定义 L&F 方法是为所有组件编写自己的 UI 类,这并不容易。
The Synth L&Fis included in JRE5 and become mature in JRE6. With Synth L&F you can customize your own look and feel with images and painter classes. You can also take a look at this IDE for Synth based L&F.
该合成器L&F被包含在JRE5并成为JRE6成熟。使用 Synth L&F,您可以使用图像和画家类自定义您自己的外观和感觉。您还可以查看这个基于 Synth 的 L&F IDE。
回答by Matthew Hegarty
Also checkout my entry to the JFXStudio challenge last year:
另请查看我去年参加 JFXStudio 挑战赛的参赛作品:
http://jfxstudio.wordpress.com/2009/11/10/challenge-five-winners/
http://jfxstudio.wordpress.com/2009/11/10/challenge-five-winners/
This is a very simple "Video Poker" game written in just less than 3,000 characters (ie 30 lines of code). Note that 90% of the graphical elements are images, which gives you an idea of the scope you have for producing "sexy" UIs.
这是一个非常简单的“视频扑克”游戏,仅用不到 3,000 个字符(即 30 行代码)编写。请注意,90% 的图形元素是图像,这让您了解制作“性感”UI 的范围。
I'll also add that the main elements of this application were written in one evening. JavaFX is a very powerful tool for UI creation once you get used to it.
我还要补充一点,这个应用程序的主要元素是在一个晚上编写的。一旦您习惯了 JavaFX,它就是一个非常强大的 UI 创建工具。
回答by Sorter
Swing alone can also create awesome looking UIs. You can explore online for number of plugins and samples to add various features. I'd recommend you go through Romain Guy'sBlog & Read his book Filthy Rich Clients. I found thisblog really cool. Swing won't disappoint you.
单独的 Swing 也可以创建外观精美的 UI。您可以在线探索插件和示例的数量以添加各种功能。我建议您浏览Romain Guy 的博客并阅读他的书Filthy Rich Clients。我发现这个博客真的很酷。Swing 不会让你失望。
回答by therealcyberlord
Yes, you can do that with JavaFX by writing your own CSS files. Learn more at: JavaFX CSS Documentation
是的,您可以通过编写自己的 CSS 文件来使用 JavaFX 来做到这一点。了解更多信息:JavaFX CSS 文档
It is actually not that hard if you are familiar with CSS.
如果您熟悉 CSS,实际上并不难。
回答by user3649688
you can get colorful original GUI with LookAndFeelMetalizer. For example phoyowas done with it.
您可以使用LookAndFeelMetalizer获得丰富多彩的原始 GUI 。例如,phoyo就完成了。