예제 #1
0
  public static String getDefaultLookAndFeelClassName() {
    switch (UiMode.getCurrentUiMode()) {
      case SWING:
        String className = UIManager.getSystemLookAndFeelClassName();

        // if the default look and feel is the cross-platform one, we might
        // need to correct this choice. E.g. - KDE, where GTK look and feel
        // would be much more appropriate
        if (className.equals(UIManager.getCrossPlatformLookAndFeelClassName())) {

          // if the current platform is Linux and the desktop manager is
          // KDE, then we should try to use the GTK look and feel
          try {
            if (System.getProperty("os.name").contains("Linux")
                && (System.getenv("KDE_FULL_SESSION") != null)) {
              // check whether the GTK look and feel class is
              // available -- we'll get CNFE if it is not and it will
              // not be set
              Class.forName(LookAndFeelType.GTK.getClassName());

              className = LookAndFeelType.GTK.getClassName();
            }
          } catch (ClassNotFoundException e) {
            ErrorManager.notifyDebug(
                ResourceUtils.getString(UiUtils.class, RESOURCE_FAILED_TO_FORCE_GTK), e);
          }
        }

        return className;
      default:
        return null;
    }
  }