source: main/trunk/gli/src/org/greenstone/gatherer/feedback/MyTextArea.java@ 24915

Last change on this file since 24915 was 9335, checked in by mdewsnip, 19 years ago

Added a comment to these five files indicating that they are not used.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1/** This class is not currently used and therefore will not be compiled by makegli. */
2
3package org.greenstone.gatherer.feedback;
4
5import javax.swing.*;
6import javax.swing.text.*;
7import java.util.Date;
8import java.awt.Color;
9
10/**
11 * This class will allow us to changed what should be inputted to the
12 * text area as the user inputted the text to the text area.
13 * @author Veronica Liesaputra
14 */
15public class MyTextArea extends JTextArea
16{
17 /**
18 * Creating an empty JTextArea.
19 */
20 public MyTextArea ()
21 {
22 super();
23 }
24
25 /**
26 * Creating a JTextArea already appended with cols.
27 * (Precondition: (cols != null))
28 * @param cols the text to be appended.
29 */
30 public MyTextArea(String cols)
31 {
32 super(cols);
33 }
34
35 /**
36 * It will give the default model this text area should use.
37 * @return the default model this text area used.
38 */
39 protected Document createDefaultModel()
40 {
41 return new UpperCaseDocument();
42 }
43
44 /**
45 * This class will be used as the default model of MyTextArea.
46 * Here we can control and modified the string that is going to be inserted to
47 * the document.
48 */
49 static class UpperCaseDocument extends PlainDocument
50 {
51 /**
52 * This method will caused the document to be appended with the date followed by newline
53 * everytime user trying to insert a new line to the document.
54 * (Precondition : (offs >= 0) && (str != null))
55 * @param offs is the offset placted to insert the string.
56 * @param str is the string to be inserted.
57 * @param a is the attribute set to be used.
58 */
59 public void insertString(int offs, String str, AttributeSet a)
60 throws BadLocationException
61 {
62 if (str == null)
63 {
64 return;
65 }
66
67 char[] upper;
68 upper = str.toCharArray();
69
70 if (str.endsWith("\n") == true)
71 {
72 String str2;
73 str2 = str + ((new Date()).toString()) + "\n\n>";
74 upper = str2.toCharArray();
75 }
76
77 super.insertString(offs, new String(upper), a);
78 }
79 }
80}
81
82
83
84
85
Note: See TracBrowser for help on using the repository browser.