1 19 20 package org.netbeans.modules.form.beaninfo.awt; 21 22 import java.beans.*; 23 import java.util.ResourceBundle ; 24 25 import org.openide.util.NbBundle; 26 import java.awt.Scrollbar ; 27 28 32 public class ScrollbarBeanInfo extends ComponentBeanInfo.Support { 33 34 public ScrollbarBeanInfo() { 35 super("scrollbar", java.awt.Scrollbar .class); } 37 38 39 protected PropertyDescriptor[] createPDs() throws IntrospectionException { 40 PropertyDescriptor[] pds = new PropertyDescriptor[] { 41 new PropertyDescriptor("unitIncrement", Scrollbar .class), new PropertyDescriptor("minimum", Scrollbar .class), new PropertyDescriptor("maximum", Scrollbar .class), new PropertyDescriptor("value", Scrollbar .class), new PropertyDescriptor("blockIncrement", Scrollbar .class), new PropertyDescriptor("orientation", Scrollbar .class), new PropertyDescriptor("visibleAmount", Scrollbar .class), }; 49 pds[5].setPropertyEditorClass(ScrollbarBeanInfo.OrientationPropertyEditor.class); 50 return pds; 51 } 52 53 54 public static class OrientationPropertyEditor extends PropertyEditorSupport { 55 String [] tags; 56 57 58 public synchronized String [] getTags() { 59 if (tags == null) { 60 ResourceBundle rb = NbBundle.getBundle(ScrollbarBeanInfo.class); 61 tags = new String [] { 62 rb.getString("HORIZONTAL"), 63 rb.getString("VERTICAL"), 64 }; 65 } 66 return tags; 67 } 68 69 public void setAsText(String s) { 70 Integer i; 71 getTags(); 72 if (s.equals(tags[0])) i = new Integer (Scrollbar.HORIZONTAL); 73 else i = new Integer (Scrollbar.VERTICAL); 74 setValue(i); 75 } 76 77 public String getAsText() { 78 int i = ((Integer ) getValue()).intValue(); 79 getTags(); 80 return i == Scrollbar.VERTICAL ? tags[1] : tags[0]; 81 } 82 83 public String getJavaInitializationString() { 84 int i = ((Integer ) getValue()).intValue(); 85 return i == Scrollbar.VERTICAL ? "java.awt.Scrollbar.VERTICAL" : "java.awt.Scrollbar.HORIZONTAL"; } 87 } 88 } 89 | Popular Tags |