1    package com.instantbank.common.uiutils;
2    
3    import javax.swing.JFrame;
4    import javax.swing.JTextArea;
5    import javax.swing.JScrollPane;
6    
7    /**
8     *  Frame used to display messages intended for the developer. Can be used as a
9     *  tiny log console for whoever neeeds to display a message on the browser.
10    *  Provides a single instance of the Frame.
11    *
12    * @author InstantBank (Rodrigo Lopez)
13    * @created September 2002
14    */
15   public class MessageFrame extends JFrame {
16   
17     /**
18      *  Area where text is put.
19      */
20     private JTextArea area = new JTextArea(10, 20);
21   
22     /**
23      *  The text can be scrolled thanks to this scrollpane.
24      */
25     private JScrollPane js;
26   
27     /**
28      *  The actual Message frame.
29      */
30     private static MessageFrame msgFr = null;
31   
32   
33     /**
34      *  Constructor for the MessageFrame.
35      */
36     private MessageFrame() {
37       js = new JScrollPane(area);
38       this.getContentPane().add(js);
39       this.setTitle("Debug Frame");
40       this.setSize(300, 200);
41       this.setVisible(true);
42     }
43   
44   
45     /**
46      *  Provides the single instance of the Frame.
47      *
48      * @return The frame value
49      */
50     public static MessageFrame getFrame() {
51       if(msgFr == null) {
52         msgFr = new MessageFrame();
53       }
54       return msgFr;
55     }
56   
57   
58     /**
59      *  Adds a feature to the Text attribute of the MessageFrame object
60      *
61      * @param s The feature to be added to the Text attribute
62      */
63     public void addText(String s) {
64       area.append(s + "\n");
65     }
66   }
67