1 14 package org.wings.template; 15 16 import org.wings.SFont; 17 18 import java.util.StringTokenizer ; 19 20 30 public class TemplateUtil { 31 32 33 public TemplateUtil() { 34 35 } 36 37 public static final SFont parseFont(String value) { 38 StringTokenizer s = new StringTokenizer (value, ","); 39 String fontName = s.nextToken(); 40 String tmpFontType = s.nextToken().toUpperCase().trim(); 41 int fontType = SFont.PLAIN; 42 if (tmpFontType.startsWith("B")) 43 fontType = SFont.BOLD; 44 else if (tmpFontType.startsWith("I")) 45 fontType = SFont.ITALIC; 46 47 int fontSize = 12; 48 try { 49 fontSize = Integer.parseInt(s.nextToken()); 50 } catch (Exception e) {} 51 52 return new SFont(fontName, fontType, fontSize); 53 } 54 55 } 57 | Popular Tags |