Ejemplo n.º 1
0
  /*
   * Installiere das jgoodies l&f
   */
  private void initLookAndFeel() {
    try {
      PlasticLookAndFeel l2 = new PlasticLookAndFeel();
      UIManager.LookAndFeelInfo info2 =
          new UIManager.LookAndFeelInfo(l2.getName(), PlasticLookAndFeel.class.getName());
      UIManager.installLookAndFeel(info2);

      Plastic3DLookAndFeel l3 = new Plastic3DLookAndFeel();
      UIManager.LookAndFeelInfo info3 =
          new UIManager.LookAndFeelInfo(l3.getName(), Plastic3DLookAndFeel.class.getName());
      UIManager.installLookAndFeel(info3);

      PlasticXPLookAndFeel l = new PlasticXPLookAndFeel();
      UIManager.LookAndFeelInfo info =
          new UIManager.LookAndFeelInfo(l.getName(), PlasticXPLookAndFeel.class.getName());
      UIManager.installLookAndFeel(info);

      WindowsLookAndFeel l4 = new WindowsLookAndFeel();
      UIManager.LookAndFeelInfo info4 =
          new UIManager.LookAndFeelInfo(l4.getName(), WindowsLookAndFeel.class.getName());
      UIManager.installLookAndFeel(info4);
    } catch (Exception e1) {
      Logger.getLogger("ControlMainView").warning(e1.getMessage());
    }
  }
Ejemplo n.º 2
0
  /** Installs the JGoodies Look & Feels, if available, in classpath. */
  public final void initializeLookAndFeels() {
    // if in classpath thry to load JGoodies Plastic Look & Feel
    try {
      LookAndFeelInfo[] lnfs = UIManager.getInstalledLookAndFeels();
      boolean found = false;
      for (int i = 0; i < lnfs.length; i++) {
        if (lnfs[i].getName().equals("JGoodies Plastic 3D")) {
          found = true;
        }
      }
      if (!found) {
        UIManager.installLookAndFeel(
            "JGoodies Plastic 3D", "com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
      }
      String os = System.getProperty("os.name");
      FontSet fontSet = null;
      if (os.startsWith("Windows")) {
        fontSet = FontSets.createDefaultFontSet(new Font("arial unicode MS", Font.PLAIN, 12));
      } else {
        fontSet = FontSets.createDefaultFontSet(new Font("arial unicode", Font.PLAIN, 12));
      }
      FontPolicy fixedPolicy = FontPolicies.createFixedPolicy(fontSet);
      PlasticLookAndFeel.setFontPolicy(fixedPolicy);

      UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
    } catch (Throwable t) {
      try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
Ejemplo n.º 3
0
 public static void setLookAndTheme(LookAndFeel laf, Object theme)
     throws UnsupportedLookAndFeelException {
   if ((laf instanceof PlasticLookAndFeel) && (theme != null) && (theme instanceof PlasticTheme)) {
     PlasticLookAndFeel.setPlasticTheme((PlasticTheme) theme);
   }
   UIManager.setLookAndFeel(laf);
 }
Ejemplo n.º 4
0
  public void setLookAndFeel() {
    String lookAndFeel = ControlMain.getSettings().getMainSettings().getLookAndFeel();
    String current = UIManager.getLookAndFeel().getClass().getName();
    boolean lfChanged = !current.equals(lookAndFeel);

    try {
      boolean themeChanged = this.isPlasticThemeChanged();
      if (themeChanged) {
        PlasticTheme inst =
            (PlasticTheme)
                (Class.forName(
                        "com.jgoodies.looks.plastic.theme."
                            + ControlMain.getSettings().getMainSettings().getPlasticTheme()))
                    .newInstance();
        PlasticLookAndFeel.setCurrentTheme(inst);
      }

      if (lfChanged || themeChanged) {
        UIManager.setLookAndFeel(lookAndFeel);
        if (lookAndFeel.indexOf("WindowsLookAndFeel") > -1
            || lookAndFeel.indexOf("WindowsClassicLookAndFeel") > -1) {
          UIManager.put("TextArea.font", new Font("Tahoma", Font.PLAIN, 11));
        }
        if (this.getView() != null) {
          this.getView().repaintGui();
        }
      }
    } catch (Exception e) {
      Logger.getLogger("ControlMainView").warning(e.getMessage());
    }
  }
Ejemplo n.º 5
0
 public static List getInstalledThemes(LookAndFeel laf) {
   return laf instanceof PlasticLookAndFeel
       ? PlasticLookAndFeel.getInstalledThemes()
       : Collections.EMPTY_LIST;
 }
Ejemplo n.º 6
0
 public static Object getDefaultTheme(LookAndFeel laf) {
   return laf instanceof PlasticLookAndFeel ? PlasticLookAndFeel.createMyDefaultTheme() : null;
 }
 public void actionPerformed(ActionEvent event) {
   PlasticLookAndFeel.setPlasticTheme(new ProtegePlasticTheme());
   super.actionPerformed(event);
 }
Ejemplo n.º 8
0
 private boolean isPlasticThemeChanged() {
   String currentTheme = PlasticLookAndFeel.getCurrentTheme().getClass().getName();
   currentTheme = currentTheme.substring(currentTheme.lastIndexOf(".") + 1);
   return !currentTheme.equals(ControlMain.getSettings().getMainSettings().getPlasticTheme());
 }
Ejemplo n.º 9
0
 public ColorUIResource getFocusColor() {
   return PlasticLookAndFeel.getHighContrastFocusColorsEnabled()
       ? Colors.ORANGE_FOCUS
       : Colors.BLUE_MEDIUM_DARK;
 }