[Schmitzm-commits] r1907 - in trunk/schmitzm-core/src/main/java/de/schmitzm: lang swing

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 23 00:48:43 CET 2012


Author: mojays
Date: 2012-03-23 00:48:43 +0100 (Fri, 23 Mar 2012)
New Revision: 1907

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/lang/ApplicationProps.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java
Log:
SwingUtil: constant for underlined font attributes
ApplicationProps: BugFix for parsing in getStringMap(.)

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/lang/ApplicationProps.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/lang/ApplicationProps.java	2012-03-22 23:08:06 UTC (rev 1906)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/lang/ApplicationProps.java	2012-03-22 23:48:43 UTC (rev 1907)
@@ -261,10 +261,10 @@
     String[] pairs = mapStr.split(";");
     for (String pairStr : pairs)
       if ( !StringUtils.isBlank(pairStr) ) {
-        String[] pair = mapStr.split(":");
+        String[] pair = pairStr.split(":");
         String   k    = pair.length > 0 ? pair[0] : "";
         String   v    = pair.length > 1 ? pair[1] : null;
-        map.put(k, v);
+        map.put(k.trim(), v.trim());
       }
     return map;
   }

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java	2012-03-22 23:08:06 UTC (rev 1906)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java	2012-03-22 23:48:43 UTC (rev 1907)
@@ -49,6 +49,7 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.MouseWheelListener;
+import java.awt.font.TextAttribute;
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -63,8 +64,10 @@
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.Random;
 import java.util.StringTokenizer;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -116,6 +119,7 @@
 import javax.swing.table.TableCellRenderer;
 import javax.swing.text.JTextComponent;
 import javax.swing.text.View;
+import javax.swing.text.AttributeSet.FontAttribute;
 import javax.swing.tree.TreeNode;
 import javax.swing.tree.TreePath;
 
@@ -185,6 +189,13 @@
 	/** A default font. */
 	public static Font DEFAULT_FONT = new Font(Font.DIALOG, Font.PLAIN,
 			12);
+	
+	/** Font attributes for an underlined font.
+	 *  @see Font#deriveFont(Map) */
+	public static Map<TextAttribute,Integer> FONT_ATTR_UNDERLINED = new HashMap<TextAttribute, Integer>();
+	static {
+	  FONT_ATTR_UNDERLINED.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
+	}
 
     // ****************************************************************************
 	// Diese Icons sind auf Basis der Icons von Gimp erstellt



More information about the Schmitzm-commits mailing list