×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Hani Ibrahim
Added: Feb 4, 2017 2:51 PM
Modified: Feb 4, 2017 3:00 PM
Views: 19
Try GTK-LaF on GNU/Linux first, then System-LaF. System-LaF on all other platforms.
  1.         //<editor-fold defaultstate="collapsed" desc="Look and Feel">
  2.         // Try GTK-LaF on GNU/Linux first, then System-LaF. System-LaF on all other platforms
  3.         if (System.getProperty("os.name").toLowerCase().contains("linux")) {
  4.             try {
  5.                 UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
  6.             } catch (Exception e1) {
  7.                 try {
  8.                     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  9.                 } catch (Exception e2) {
  10.                     System.err.println("Look & Feel Error\n" + e2.getMessage());
  11.                 }
  12.             }
  13.         } else {
  14.             try {
  15.                 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  16.             } catch (Exception e2) {
  17.                 System.err.println("Look & Feel Error\n" + e2.getMessage());
  18.             }
  19.         }
  20.         //</editor-fold>