-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriver3.java
More file actions
50 lines (43 loc) · 1.04 KB
/
Driver3.java
File metadata and controls
50 lines (43 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* A driver for testing the FormattedDocument class
*/
public class Driver3
{
/**
* The entry point of the application
*
* @param args The command line arguments
* @author Maricel Vicente
*/
public static void main(String[] args)
{
Document formatted;
String text;
text = "George is a little monkey, "+
"and all monkeys are curious.\n"+
"But no monkey is as curious "+
"as George.";
formatted = new FormattedDocument(text, 20);
print(formatted);
}
/**
* Print a Document
*/
private static void print(Document doc)
{
System.out.println("A document:");
System.out.println();
System.out.println(doc.getText());
System.out.println("\n");
}
/**
* Print a FormattedDocument
*/
private static void print(FormattedDocument doc)
{
System.out.println("A nicely formatted document:");
System.out.println();
System.out.println(doc.getText());
System.out.println("\n");
}
}