我一直在检查 java 桌面应用程序的外观,然后找到了外观Synth
和Nimbus
感觉
但我在这里有点困惑
有人可以告诉我:
两者的区别。
这更容易理解和实施。
以及哪一个呈现最好的界面
很高兴有示例的链接
我一直在检查 java 桌面应用程序的外观,然后找到了外观Synth
和Nimbus
感觉
但我在这里有点困惑
有人可以告诉我:
两者的区别。
这更容易理解和实施。
以及哪一个呈现最好的界面
很高兴有示例的链接
使用合成器外观,您可以通过 xml 文件提供您自己的自定义外观。前任:
<imagePainter method="panelBackground" path="images/main-bg.png" sourceInsets="0 0 0 0" stretch="true"/>
</style>
<bind style="panelStyle" type="region" key="Panel"/>
<style id="ProgressBarStyle">
<object id="progressbarPainter" class="com.poseidon.desktopframework.images.BackgroundPainter"></object>
<state>
<font name="Verdana" size="14"/>
<color value="BLACK" type="TEXT_FOREGROUND"/>
<painter method="progressBarBackground" idref="progressbarPainter"/>
<painter method="progressBarForeground" idref="progressbarPainter"/>
<!-- <imagePainter method="ArrowButtonBackground" path="images/dropdown-icon-big.png" center="true"/>
<imagePainter method="ArrowButtonBackground" path="images/dropdown-icon-big.png" center="true"/>-->
</state>
<!-- <imagePainter method="textAreaBorder" path="images/textbox-small.png" sourceInsets="4 6 4 6" paintCenter="false"/> -->
</style>
<bind style="ProgressBarStyle" type="region" key="ProgressBar"/>
<style id="fileChooserStyle">
<imageIcon id="homeIcon" path="images/home.png"/>
<object id="fileChooserBackGround" class="com.poseidon.desktopframework.images.BackgroundPainter"></object>
-->
您不必实现外观。您只需将其应用于您的 Swing UI。两者的代码相同。
哪个呈现最佳界面也是一个品味问题。它们都应该可以正常工作,只是(顾名思义)外观和感觉不同。您可以看到自己的外观差异。不知道感觉(行为)的差异,我怀疑是否有可能给出一个令人满意的列表。
只需按照您想要的方式实现您的 UI,然后使用UIManager.setLookAndFeel()
.
我个人认为使用系统外观和感觉是个好主意。它使 UI 看起来像系统默认设置。例如,在 Windows 上它看起来像一个 Windows 程序,而在 Gnome 上它看起来像一个 GTK 应用程序。
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
您可以在http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html进一步了解它