You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2009/05/01 20:01:33 UTC

svn commit: r770777 - in /jakarta/jmeter/trunk: bin/jmeter.properties src/core/org/apache/jmeter/gui/action/LookAndFeelCommand.java

Author: sebb
Date: Fri May  1 18:01:32 2009
New Revision: 770777

URL: http://svn.apache.org/viewvc?rev=770777&view=rev
Log:
 Bug 47064 -  Use System default Look And Feel (Mac)

Modified:
    jakarta/jmeter/trunk/bin/jmeter.properties
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/LookAndFeelCommand.java

Modified: jakarta/jmeter/trunk/bin/jmeter.properties
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/bin/jmeter.properties?rev=770777&r1=770776&r2=770777&view=diff
==============================================================================
--- jakarta/jmeter/trunk/bin/jmeter.properties (original)
+++ jakarta/jmeter/trunk/bin/jmeter.properties Fri May  1 18:01:32 2009
@@ -84,6 +84,9 @@
 #  Metal   = javax.swing.plaf.metal.MetalLookAndFeel
 #  Motif   = com.sun.java.swing.plaf.motif.MotifLookAndFeel
 #  Windows = com.sun.java.swing.plaf.windows.WindowsLookAndFeel
+#
+#  Or one of the strings "System" or "CrossPlatform" which means
+#  JMeter will use the corresponding string returned by UIManager.get<name>LookAndFeelClassName()
 
 # LAF can be overridden by os.name (lowercased, spaces replaced by '_')
 # Sample os.name LAF:
@@ -97,6 +100,11 @@
 # default LAF
 jmeter.laf=javax.swing.plaf.metal.MetalLookAndFeel
 
+# Failing that, JMeter uses the CrossPlatform LAF.
+
+# Mac apparently looks better with the System LAF
+jmeter.laf.mac=System
+
 # Icon definitions
 # default:
 #jmeter.icons=org/apache/jmeter/images/icon.properties

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/LookAndFeelCommand.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/LookAndFeelCommand.java?rev=770777&r1=770776&r2=770777&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/LookAndFeelCommand.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/LookAndFeelCommand.java Fri May  1 18:01:32 2009
@@ -71,20 +71,31 @@
         // Spaces are not allowed in property names read from files
         laf = JMeterUtils.getProperty(JMETER_LAF+"."+osName.replace(' ', '_'));
         if (laf != null) {
-            return laf;
+            return checkLafName(laf);
         }
         String[] osFamily = osName.split("\\s"); // e.g. windows xp => windows
         laf = JMeterUtils.getProperty(JMETER_LAF+"."+osFamily[0]);
         if (laf != null) {
-            return laf;
+            return checkLafName(laf);
         }
         laf = JMeterUtils.getProperty(JMETER_LAF);
         if (laf != null) {
-            return laf;
+            return checkLafName(laf);
         }
         return UIManager.getCrossPlatformLookAndFeelClassName();
     }
 
+    // Check if LAF is a built-in one
+    private static String checkLafName(String laf){
+        if ("system".equalsIgnoreCase(laf)){ // $NON-NLS-1$
+            return UIManager.getSystemLookAndFeelClassName();
+        }
+        if ("crossplatform".equalsIgnoreCase(laf)){ // $NON-NLS-1$
+            return UIManager.getCrossPlatformLookAndFeelClassName();
+        }
+        return laf;
+    }
+
     public LookAndFeelCommand() {
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org