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 |
{ |
{ |
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 |
|
|