/Users/lyon/j4p/src/gui/JInfoFrame.java

1    package gui; 
2     
3    import javax.swing.*; 
4    import java.awt.*; 
5     
6    public class JInfoFrame extends JClosableFrame { 
7        private JTextArea ta = new JTextArea(null, "", 60, 40); 
8     
9     
10       public JInfoFrame() { 
11           super(":InfoFrame"); 
12           ta.setEditable(false); 
13           JScrollPane jsp = new JScrollPane(ta); 
14           Container c = getContentPane(); 
15           c.add(jsp, BorderLayout.CENTER); 
16       } 
17    
18       public static void main(String[] args) { 
19           JInfoFrame jif = new JInfoFrame(); 
20           jif.setSize(200, 200); 
21    
22           for (int i = 0; i < 100; i++) 
23               jif.println("hello world!" + i); 
24           jif.show(); 
25       } 
26    
27       public void print(Object s) { 
28           ta.append(s.toString()); 
29       } 
30    
31       public void println() { 
32           ta.append("\n"); 
33       } 
34    
35       public void println(Object s) { 
36           ta.append(s.toString() + "\n"); 
37       } 
38    
39   }