1 package com.ca.directory.jxplorer.editor; 2 3 import com.ca.commons.cbutil.*; 4 import javax.swing.*; 5 import java.awt.*; 6 7 12 public class largestringeditor extends CBDialog 13 implements abstractstringeditor 14 { 15 protected JTextArea area; 16 protected JScrollPane scroll; 17 protected editablestring editableText; 18 19 22 public largestringeditor(Frame owner, editablestring text) 23 { 24 super(owner, CBIntText.get("Simple Text Editor"), null); 25 setModal(true); 26 27 area = new JTextArea(); 28 area.setLineWrap(true); 30 scroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scroll.setViewport(new CBViewport()); 32 scroll.getViewport().setView(area); 33 scroll.setPreferredSize(new Dimension(310,60)); 34 35 makeHeavy(); 36 addln(scroll); 37 38 setSize(500, 400); 39 40 setStringValue(text); 41 } 42 43 47 public void setStringValue(editablestring originalText) 48 { 49 editableText = originalText; 50 area.setText(editableText.getStringValue()); 51 JViewport port = scroll.getViewport(); 52 if (port != null) 53 port.setViewPosition(new Point(0,0)); 54 else 55 System.out.println("NULL VIEWPORT"); 56 } 57 58 61 public void doOK() 62 { 63 String newAttribute = area.getText(); 64 65 68 editableText.setStringValue(newAttribute); 69 70 super.doOK(); 71 } 72 } | Popular Tags |