1 10 11 import java.awt.*; 12 import java.io.*; 13 import java.beans.*; 14 import javax.activation.*; 15 16 public class TextInternalizer extends Panel implements Externalizable { 17 private TextArea text_area = null; 19 20 private File text_file = null; 22 private String text_buffer = null; 23 24 private DataHandler _dh = null; 25 private boolean DEBUG = false; 26 29 public TextInternalizer() { 30 System.out.println("TextInternalizer!!!!!"); 31 32 setLayout( new GridLayout(1,1)); 33 text_area = new TextArea("", 24, 80, 35 TextArea.SCROLLBARS_VERTICAL_ONLY ); 36 text_area.setEditable( false ); 37 38 add(text_area); 39 } 40 41 public void writeExternal(ObjectOutput out) throws IOException{ 42 43 } 44 45 public void readExternal(ObjectInput in) throws IOException, 46 ClassNotFoundException { 47 48 49 this.setObjectInput(in); 50 } 51 52 53 54 61 65 public void setObjectInput(ObjectInput ins) throws IOException { 66 try { 67 68 text_buffer = (String )ins.readObject(); 69 } catch(Exception e){ e.printStackTrace(); } 70 text_area.setText(text_buffer); 72 73 } 74 public void addNotify() { 76 super.addNotify(); 77 invalidate(); 78 } 79 public Dimension getPreferredSize() { 81 return text_area.getMinimumSize(24, 80); 82 } 83 84 } 85 86 87 88 89 90 91 | Popular Tags |