1 16 package org.mortbay.html; 17 import java.io.IOException ; 18 import java.io.Writer ; 19 20 24 public class Frame 25 { 26 String SRC=null; 27 String name=null; 28 29 String scrolling="auto"; 30 String resize=""; 31 String border=""; 32 33 34 36 Frame(){} 37 38 39 public Frame border(boolean threeD, int width, String color) 40 { 41 border=" frameborder=\""+(threeD?"yes":"no")+"\""; 42 if (width>=0) 43 border+=" border=\""+width+"\""; 44 45 if (color!=null) 46 border+=" BORDERCOLOR=\""+color+"\""; 47 return this; 48 } 49 50 public Frame name(String name,String src) 51 { 52 this.name=name; 53 this.src=src; 54 return this; 55 } 56 57 58 public Frame src(String s) 59 { 60 src=s; 61 return this; 62 } 63 64 65 public Frame name(String n) 66 { 67 name=n; 68 return this; 69 } 70 71 72 public Frame scrolling(boolean s) 73 { 74 scrolling=s?"yes":"no"; 75 return this; 76 } 77 78 79 public Frame resize(boolean r) 80 { 81 resize=r?"":" noresize"; 82 return this; 83 } 84 85 86 void write(Writer out) 87 throws IOException 88 { 89 out.write("<frame scrolling=\""+scrolling+"\""+resize+border); 90 91 if(src!=null) 92 out.write(" SRC=\""+src+"\""); 93 if(name!=null) 94 out.write(" name=\""+name+"\""); 95 out.write(">"); 96 } 97 }; 98 99 100 101 102 103 104 | Popular Tags |