public static String getSystemLookAndFeelClassName() {
String systemLAF = ( String )AccessController.doPrivileged(
new GetPropertyAction( "swing.systemlaf" ));
if (systemLAF != null ) {
return systemLAF;
}
String osName = ( String )AccessController.doPrivileged(
new GetPropertyAction( "os.name" ));
if (osName != null ) {
if (osName.indexOf( "Windows" ) != -1) {
return "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" ;
}
else {
String desktop = ( String )AccessController.doPrivileged(
new GetPropertyAction( "sun.desktop" ));
if ( "gnome" .equals(desktop)) {
// May be set on Linux and Solaris boxs.
return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" ;
}
if ((osName.indexOf( "Solaris" ) != -1) ||
(osName.indexOf( "SunOS" ) != -1)) {
return "com.sun.java.swing.plaf.motif.MotifLookAndFeel" ;
}
}
}
return getCrossPlatformLookAndFeelClassName();
}
* This source code was highlighted with Source Code Highlighter .
public static String getSystemLookAndFeelClassName() {
String result = getCrossPlatformLookAndFeelClassName();
String systemLAF = ( String )AccessController.doPrivileged(
new GetPropertyAction( "swing.systemlaf" ));
if (systemLAF != null ) {
result = systemLAF;
}
String osName = ( String )AccessController.doPrivileged(
new GetPropertyAction( "os.name" ));
if (osName != null ) {
if (osName.indexOf( "Windows" ) != -1) {
result = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" ;
}
else {
String desktop = ( String )AccessController.doPrivileged(
new GetPropertyAction( "sun.desktop" ));
if ( "gnome" .equals(desktop)) {
// May be set on Linux and Solaris boxs.
result = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" ;
}
if ((osName.indexOf( "Solaris" ) != -1) ||
(osName.indexOf( "SunOS" ) != -1)) {
result = "com.sun.java.swing.plaf.motif.MotifLookAndFeel" ;
}
}
}
return result;
}
* This source code was highlighted with Source Code Highlighter .
Source: https://habr.com/ru/post/67430/
All Articles