1 package net.suberic.util.gui.propedit; 2 import javax.swing.*; 3 import net.suberic.util.*; 4 5 9 public class TextMessageEditorPane extends SwingPropertyEditor { 10 protected JTextArea textArea; 11 12 13 20 public void configureEditor(String propertyName, String template, String propertyBaseName, PropertyEditorManager newManager) { 21 configureBasic(propertyName, template, propertyBaseName, newManager); 22 23 String defaultLabel; 24 int dotIndex = editorTemplate.lastIndexOf("."); 25 if (dotIndex == -1) 26 defaultLabel = new String (editorTemplate); 27 else 28 defaultLabel = property.substring(dotIndex+1); 29 30 32 this.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), manager.getProperty(editorTemplate + ".label", defaultLabel))); 34 38 textArea = new JTextArea(manager.getProperty(editorTemplate + ".message", "No message.")); 41 textArea.setEditable(false); 42 JLabel testLab = new JLabel(); 43 textArea.setBackground(testLab.getBackground()); 44 textArea.setFont(testLab.getFont()); 45 this.add(textArea); 46 47 } 48 49 55 public void setValue() { 56 57 } 58 59 65 public void validateProperty() { 66 67 } 68 69 75 public java.util.Properties getValue() { 76 java.util.Properties retProps = new java.util.Properties (); 77 78 return retProps; 79 } 80 81 85 public void resetDefaultValue() { 86 } 87 88 91 public void setSelectedValue(String newValue) { 92 } 93 94 98 public boolean isChanged() { 99 return false; 100 } 101 102 105 protected void updateEditorEnabled() { 106 if (textArea != null) 107 textArea.setEnabled(isEnabled()); 108 } 109 110 113 public PropertyEditorPane getPropertyEditorPane() { 114 return getPropertyEditorPane(this); 115 } 116 117 120 public String getDisplayValue() { 121 return getProperty(); 122 } 123 124 } 125 | Popular Tags |