Created
March 4, 2016 09:47
-
-
Save AMDG2/9c657ed4efe102313831 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void initLookAndFeel() { | |
try { | |
if (OSValidator.isWindows()) | |
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); | |
else if (OSValidator.isLinux()) | |
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); | |
else if (OSValidator.isUnix()) | |
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); | |
else | |
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); | |
} catch (ClassNotFoundException | InstantiationException | UnsupportedLookAndFeelException | IllegalAccessException e) { | |
showError(e); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hotelManager.utils; | |
/** | |
* OSValidator class | |
*/ | |
public class OSValidator { | |
private static String OS = System.getProperty("os.name").toLowerCase(); | |
public static boolean isWindows() { | |
return (OS.contains("win")); | |
} | |
public static boolean isMac() { | |
return (OS.contains("mac")); | |
} | |
public static boolean isLinux() { | |
return OS.contains("linux"); | |
} | |
public static boolean isUnix() { | |
return (OS.contains("nix") || OS.contains("nux") || OS.indexOf("aix") > 0); | |
} | |
public static boolean isSolaris() { | |
return (OS.contains("sunos")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment