简体   繁体   English

如何在Swing应用程序中使用第三方主题?

[英]How to use third party themes in swing application?

I want to use some third party themes (like synthetica http://www.javasoft.de/synthetica/themes/ ) in my swing appliaction. 我想在自己的挥杆动作中使用一些第三方主题(例如,合成类http://www.javasoft.de/synthetica/themes/ )。 i am using eclipse ide , got the jar file of theme and did the following modification(according to the readme file from the theme) in my code 我正在使用eclipse ide ,获取了主题的jar文件,并在我的代码中做了以下修改(根据主题的自述文件)

try 
  {      
   UIManager.setLookAndFeel(new SyntheticaBlackMoonLookAndFeel());
  } 
  catch (Exception e) 
  {
   e.printStackTrace();
  }

but after this modification its showing the following error 但经过此修改后,它显示以下错误

 The type de.javasoft.plaf.synthetica.SyntheticaLookAndFeel cannot be resolved. It is indirectly referenced from required .class files

what does this mean? 这是什么意思? i tried searching on net but cant really find any useful answers 我尝试在网上搜索,但找不到真正有用的答案

Contents of Readme file: 自述文件的内容:

System Requirements
===================

Java SE 5 (JRE 1.5.0) or above
Synthetica V2.2.0 or above

Integration
===========

1. Ensure that your classpath contains all Synthetica libraries (including
   Synthetica's core library 'synthetica.jar').

2. Enable the Synthetica Look and Feel at startup time in your application:

    import de.javasoft.plaf.synthetica.SyntheticaBlackMoonLookAndFeel;

    try 
    {
      UIManager.setLookAndFeel(new SyntheticaBlackMoonLookAndFeel());
    } 
    catch (Exception e) 
    {
      e.printStackTrace();
    }    

It means you are missing dependant classes. 这意味着您缺少依赖类。 If you look at the requirements it also requires "Synthetica Standard Look and Feel" 如果您查看要求,则还需要“ Synthetica标准外观”

you can download it here 你可以在这里下载

If you have downloaded the .jar -file, then you need to add it to your build path in eclipse. 如果您已下载.jar -file,则需要将其添加到eclipse中的构建路径中。

Ie if you in your eclipse project have a directory lib where you put your .jar -files, then right-click on your jar-file and chose Build Path then Add to Build Path . 即,如果您在eclipse项目中具有放置.jar文件的目录lib ,则右键单击jar文件并选择Build Path,然后选择Add to Build Path

I know that the issue might have been resolved as this is a very old post, but as this may contribute other current users (like myself): 我知道这个问题可能已经解决,因为这是一篇很老的文章,但是因为这可能会导致其他当前用户(例如我自己):

  • First you must add the Synthetica.jar first then add a theme. 首先,您必须先添加Synthetica.jar,然后添加主题。 To downlaod Synthetica.jar visit this link : jyloo.com/synthetica/download .To download a theme try jyloo.com/synthetica/themes 要下载Synthetica.jar,请访问以下链接: jyloo.com/synthetica/download 。要下载主题,请尝试jyloo.com/synthetica/themes。
  • Right-click on you project and click on "Properties" 右键单击您的项目,然后单击“属性”
  • On Java Build Path , select the third tab and the click "Add JARs" or "Add External JARs..." and locate the .jar files and the click "Open" 在Java Build Path上,选择第三个选项卡,然后单击“添加JAR”或“添加外部JAR ...”,然后找到.jar文件,然后单击“打开”
  • Click "Ok" and the to enable theme, you can use this code: 点击“确定”,然后启用主题,您可以使用以下代码:

     try { UIManager.setLookAndFeel(new SyntheticaBlueMoonLookAndFeel()); } catch (Exception e) { e.printStackTrace(); } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM