1 18 19 package org.objectweb.jac.aspects.gui.swing; 20 21 import org.objectweb.jac.aspects.gui.FieldView; 22 import org.objectweb.jac.core.rtti.FieldItem; 23 import javax.swing.JComponent ; 24 import javax.swing.JTextArea ; 25 26 29 30 public class TextViewer extends AbstractFieldView 31 implements FieldView 32 { 33 JTextArea textArea = new JTextArea (); 34 35 public TextViewer(Object value, Object substance, FieldItem field) { 36 super(substance,field); 37 textArea.setEditable(false); 38 textArea.setLineWrap(true); 39 setValue(value); 40 add(textArea); 41 } 42 43 public void setValue(Object text) { 44 if( text == null ) { 45 textArea.setText(""); 46 } else { 47 textArea.setText(text.toString()); 48 } 49 } 50 51 public Object getValue() { 52 return textArea.getText(); 53 } 54 55 protected JComponent getComponent() { 56 return textArea; 57 } 58 } 59 60 | Popular Tags |