[Lilith-devel] SF.net SVN: lilith:[318] trunk/lilith/src
Brought to you by:
huxhorn
|
From: <hu...@us...> - 2009-08-30 22:50:21
|
Revision: 318
http://lilith.svn.sourceforge.net/lilith/?rev=318&view=rev
Author: huxhorn
Date: 2009-08-30 22:50:11 +0000 (Sun, 30 Aug 2009)
Log Message:
-----------
Mac menu-bar is used for all PLAFs.
Modified Paths:
--------------
trunk/lilith/src/changes/changes.xml
trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java
Modified: trunk/lilith/src/changes/changes.xml
===================================================================
--- trunk/lilith/src/changes/changes.xml 2009-08-30 22:45:41 UTC (rev 317)
+++ trunk/lilith/src/changes/changes.xml 2009-08-30 22:50:11 UTC (rev 318)
@@ -86,6 +86,9 @@
</release>
<release version="0.9.37" date="TBD" description="Future release">
+ <action dev="jhux" type="update">
+ MAC: Mac menu-bar is used for all PLAFs. Thanks to Kirill Grouchnikov - http://www.pushing-pixels.org/?p=366
+ </action>
<action dev="jhux" type="add" issue="65">
Added "Troubleshooting..." menu item in "Help" menu as a shortcut to the throubleshooting section of Preferences.
</action>
Modified: trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java
===================================================================
--- trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java 2009-08-30 22:45:41 UTC (rev 317)
+++ trunk/lilith/src/main/java/de/huxhorn/lilith/Lilith.java 2009-08-30 22:50:11 UTC (rev 318)
@@ -60,6 +60,8 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
import java.util.logging.Handler;
import javax.swing.*;
@@ -416,6 +418,10 @@
//UIManager.installLookAndFeel("Napkin", "net.sourceforge.napkinlaf.NapkinLookAndFeel");
Application application = new DefaultApplication();
ApplicationPreferences applicationPreferences = new ApplicationPreferences();
+
+ final String[] defaultNames={"MenuBarUI", "MenuUI", "MenuItemUI", "CheckBoxMenuItemUI", "RadioButtonMenuItemUI", "PopupMenuUI"};
+
+ HashMap<String, Object> storedDefaults = new HashMap<String, Object>();
if(application.isMac())
{
// Use Apple Aqua L&F screen menu bar if available; set property before any frames created
@@ -429,6 +435,22 @@
System.setProperty("com.apple.macos.useScreenMenuBar", "true");
// this shouldn't happen since we only run on 1.5+
}
+
+ // this is part 1 of Mac Menu for all PLAFs.
+ // Thanks to Kirill Grouchnikov - http://www.pushing-pixels.org/?p=366
+ try
+ {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+
+ for(String current : defaultNames)
+ {
+ storedDefaults.put(current, UIManager.get(current));
+ }
+ }
+ catch(Throwable t)
+ {
+ if(logger.isErrorEnabled()) logger.error("Exception while setting SystemLookAndFeel!!", t);
+ }
}
// init look & feel
@@ -448,22 +470,18 @@
}
}
}
- catch(UnsupportedLookAndFeelException e)
+ catch(Throwable t)
{
- // ignore
+ if(logger.isErrorEnabled()) logger.error("Exception while setting look & feel '"+lookAndFeel+"'!", t);
}
- catch(ClassNotFoundException e)
+
+ // this is part 2 of Mac Menu for all PLAFs.
+ // Thanks to Kirill Grouchnikov - http://www.pushing-pixels.org/?p=366
+ if(logger.isDebugEnabled()) logger.debug("storedDefaults: {}", storedDefaults);
+ for(Map.Entry<String, Object> current:storedDefaults.entrySet())
{
- // ignore
+ UIManager.put(current.getKey(), current.getValue());
}
- catch(InstantiationException e)
- {
- // ignore
- }
- catch(IllegalAccessException e)
- {
- // ignore
- }
}
boolean splashScreenDisabled = applicationPreferences.isSplashScreenDisabled();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|