Author: remi
Date: 2008-09-19 11:19:17 +0200 (Fri, 19 Sep 2008)
New Revision: 1915

Modified:
   
software_suite_v2/software/tools/tuxController/trunk/src/tuxController/main.java
Log:
* fixed font problems
* fixed frame borders bug (with the skin)


Modified: 
software_suite_v2/software/tools/tuxController/trunk/src/tuxController/main.java
===================================================================
--- 
software_suite_v2/software/tools/tuxController/trunk/src/tuxController/main.java
    2008-09-19 08:55:07 UTC (rev 1914)
+++ 
software_suite_v2/software/tools/tuxController/trunk/src/tuxController/main.java
    2008-09-19 09:19:17 UTC (rev 1915)
@@ -21,9 +21,12 @@
 
 package tuxController;
 
+import java.awt.Font;
+
 import GUI.mainWindow;
 import com.l2fprod.gui.plaf.skin.SkinLookAndFeel;
 import com.l2fprod.util.OS;
+
 import javax.swing.JDialog;
 import javax.swing.JFrame;
 import javax.swing.UIManager;
@@ -33,35 +36,88 @@
  * @author paul
  */
 public class main {
+       
+       public static void setUIFont(javax.swing.plaf.FontUIResource f) {
+           java.util.Enumeration<?> keys = UIManager.getDefaults().keys();
+           
+           while (keys.hasMoreElements()) {
+               Object key = keys.nextElement();
+               Object value = UIManager.get (key);
+               
+               if (value instanceof javax.swing.plaf.FontUIResource)
+                       UIManager.put (key, f);
+           }
+       }
 
     /**
      * @param args the command line arguments
      */
     public static void main(String[] args) {
-       // Skinlf Begin
-               try
+       
+       String fontName;
+
+               // On windows
+               if (System.getProperty("os.name").contains("Windows"))
                {
-                       String themepack = 
"C:\\tuxdroid\\resources\\skin\\tuxthemepack.zip";
-                       
SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePack(themepack));
-                       
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
+                       fontName = "Verdana";
                        
-                   if (OS.isOneDotFourOrMore())
-                   {
-                     java.lang.reflect.Method method =
-                       JFrame.class.getMethod(
-                         "setDefaultLookAndFeelDecorated",
-                         new Class[] { boolean.class });
-                     method.invoke(null, new Object[] { Boolean.TRUE });
-                     
-                     method =
-                       JDialog.class.getMethod(
-                         "setDefaultLookAndFeelDecorated",
-                         new Class[] { boolean.class });
-                     method.invoke(null, new Object[] { Boolean.TRUE });
-                   }
+                       // Set the skin
+                       try
+                       {
+                               SkinLookAndFeel.setSkin(
+                                               SkinLookAndFeel.loadThemePack(
+                                                               
"C:/tuxdroid/resources/skin/tuxthemepack.zip"));
+                               UIManager.setLookAndFeel(new SkinLookAndFeel());
+                               
+                               if (OS.isOneDotFourOrMore())
+                           {
+                             java.lang.reflect.Method method =
+                               JFrame.class.getMethod(
+                                 "setDefaultLookAndFeelDecorated",
+                                 new Class[] { boolean.class });
+                             method.invoke(null, new Object[] { Boolean.TRUE 
});
+                             
+                             method =
+                               JDialog.class.getMethod(
+                                 "setDefaultLookAndFeelDecorated",
+                                 new Class[] { boolean.class });
+                             method.invoke(null, new Object[] { Boolean.TRUE 
});
+                           }
+                       }
+                       catch (Exception e) {}
                }
-               catch (Exception e) {}
-               // Skinlf end
+               // On linux
+               else
+               {
+                       fontName = "Bitstream Vera Sans";
+                       
+                       // Set the skin
+                       try
+                       {
+                               SkinLookAndFeel.setSkin(
+                                               SkinLookAndFeel.loadThemePack(
+                                                               
"./tuxthemepack.zip"));
+                               UIManager.setLookAndFeel(new SkinLookAndFeel());
+                       }
+                       catch (Exception e) {}
+               }
+               
+               // Set the global font
+               setUIFont(new javax.swing.plaf.FontUIResource(
+                               fontName,
+                               Font.PLAIN,
+                               11));
+               // Set the frame title font
+               UIManager.put("InternalFrame.titleFont",new Font(
+                               fontName,
+                               Font.BOLD,
+                               12));
+               // Set the menu font
+               UIManager.put("Menu.font",new Font(
+                               fontName,
+                               Font.BOLD,
+                               11));
+
         mainWindow win = new mainWindow();
         win.mainWin();
     }


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to