我一直在检查java桌面应用程序的外观和感觉然后找到Synth
和Nimbus
的Look and Feel
但是这里我有点困惑
谁能告诉我:
-
两者的区别
-
这样更容易理解和实现。
-
哪一个呈现最好的界面
将很高兴有链接到示例
您不必实现外观。你只需要把它应用到你的Swing UI上。代码是一样的
谁设计出最好的界面也是一个品位问题。它们都可以很好地工作,只是(顾名思义)外观和感觉不同。你自己就能看到长相上的不同。我不知道感觉(行为)上的差异,我怀疑是否可能给出一个令人满意的清单。
按你想要的方式实现你的UI,然后使用UIManager.setLookAndFeel()
尝试不同的外观和感觉。
我个人认为使用系统的外观和感觉是个好主意。它使UI看起来像系统默认值。例如,在Windows上它看起来像一个Windows程序,而在Gnome上它看起来像一个GTK应用程序。
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
您可以在http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
使用synth外观,您可以通过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>
- ->