/[gcjwebplugin]/gcjwebplugin/src/gnu/gcjwebplugin/AppletTag.java
ViewVC logotype

Diff of /gcjwebplugin/src/gnu/gcjwebplugin/AppletTag.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by mkoch, Fri Jul 2 12:41:48 2004 UTC revision 1.17 by fitzsim, Sun Jul 25 16:52:37 2004 UTC
# Line 33  import java.util.HashMap; Line 33  import java.util.HashMap;
33  import java.util.Iterator;  import java.util.Iterator;
34  import java.util.List;  import java.util.List;
35  import java.util.StringTokenizer;  import java.util.StringTokenizer;
36    import java.text.NumberFormat;
37    import java.text.ParseException;
38    import java.util.Locale;
39    
40  class AppletTag  class AppletTag
41  {  {
# Line 430  class AppletTag Line 432  class AppletTag
432              + "  parameters=" + parameters + "\n" + "  documentbase="              + "  parameters=" + parameters + "\n" + "  documentbase="
433              + documentbase + "\n");              + documentbase + "\n");
434    }    }
435    
436      public static Dimension getSize (AppletTag tag)
437      {
438        NumberFormat numberFormat;
439        Dimension size = new Dimension();
440    
441        try
442          {
443            String widthStr = (String) tag.parameters.get("width");
444    
445            if (widthStr.charAt(widthStr.length() - 1) == '%')
446              numberFormat = NumberFormat.getPercentInstance(Locale.US);
447            else
448              numberFormat = NumberFormat.getInstance(Locale.US);
449    
450            // FIXME: Handle percentage somehow.
451            size.width = numberFormat.parse(widthStr).intValue();
452          }
453        catch (ParseException e)
454          {
455            // Use default.
456            size.width = 320;
457          }
458    
459        try
460          {
461            String heightStr = (String) tag.parameters.get("height");
462    
463            if (heightStr.charAt(heightStr.length() - 1) == '%')
464              numberFormat = NumberFormat.getPercentInstance(Locale.US);
465            else
466              numberFormat = NumberFormat.getInstance(Locale.US);
467    
468            // FIXME: Handle percentage somehow.
469            size.height = numberFormat.parse(heightStr).intValue();
470          }
471        catch (ParseException e)
472          {
473            // Use default.
474            size.height = 200;
475          }
476    
477        return size;
478      }
479  }  }
480    
481    

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26