D:\NewZebra\JavaApplications\DesignPatternsProject\src\structural_patterns\pdf_facade_pattern\TextBaseProduct.java |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package structural_patterns.pdf_facade_pattern;
21
22
23
24 @author
25
26
27
28 import java.io.*;
29 import java.text.*;
30 import java.util.*;
31 import java.lang.*;
32 import java.awt.event.*;
33 import java.awt.*;
34 import javax.swing.*;
35
36
37 public class TextBaseProduct implements java.io.Serializable, Product {
38
39 Vector linesOfTextVecxtor = null;
40
41
42
43 public TextBaseProduct() {
44 }
45
46
47
48 public int getProductType(){
49 return(PDF_Base.TEXT_OBJECT_TYPE);
50 }
51
52
53
54 public int populateTextArea(JTextArea passedJTextArea, Font passedFont){
55
56 if(null == linesOfTextVecxtor)
57 return(-1);
58
59 int count;
60 int vectorSize = linesOfTextVecxtor.size();
61 String line = "";
62 String newLine = "\n";
63
64 passedJTextArea.setFont(passedFont);
65
66 for(count =0; count < vectorSize; count++)
67 {
68 line = (String)linesOfTextVecxtor.elementAt(count);
69 passedJTextArea.append(line + newLine);
70 }
71 passedJTextArea.append(newLine + newLine + newLine);
72 passedJTextArea.moveCaretPosition(0);
73 return(0);
74 }
75
76 }
77
78