Le Wed, 24 Jun 2009 18:17:23 +0200 (CEST), chatellier at users.labs.libre-entreprise.org a écrit :
Author: chatellier Date: 2009-06-24 16:17:23 +0000 (Wed, 24 Jun 2009) New Revision: 2427
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java Log: LAF init is now JKD compatible
Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2009-06-24 14:49:12 UTC (rev 2426) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/IsisFish.java 2009-06-24 16:17:23 UTC (rev 2427) @@ -130,7 +130,7 @@ config.doAction(IsisConfig.STEP_AFTER_INIT); // initVCS ask for passphrase, ui must be set before - initLoookAndFeel(); + initLookAndFeel();
// static vcs init (needed for some actions) try { @@ -156,13 +156,23 @@ } }
- private static void initLoookAndFeel() throws InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { - try { - Class.forName("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); - UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); - } catch (ClassNotFoundException e) { - // could not fin nimbus look-and-feel - log.warn(_("cant start nimbus")); + /** + * Install "Nimbus" LookAndFeel if available. + * + * @throws InstantiationException + * @throws IllegalAccessException + * @throws UnsupportedLookAndFeelException + */ + private static void initLookAndFeel() throws InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { + for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(laf.getName())) { + try { + UIManager.setLookAndFeel(laf.getClassName()); + } catch (ClassNotFoundException e) { + // could not fin nimbus look-and-feel + log.warn("Can't install nimbus"); + } + } } }
pour info, ce code existe dans JAXX :) jaxx.runtime.SwingUtil.initNimbusLoookAndFeel();
_______________________________________________ Isis-fish-commits mailing list Isis-fish-commits at lists.labs.libre-entreprise.org https://lists.labs.libre-entreprise.org/mailman/listinfo/isis-fish-commits
-- Tony Chemit -------------------- tél: +33 (0) 2 40 50 29 28 email: chemit at codelutin.com http://www.codelutin.com