001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.form.beaninfo.swing;
043:
044: import java.beans.*;
045: import javax.swing.border.TitledBorder;
046:
047: public class TitledBorderBeanInfo extends BISupport {
048:
049: public TitledBorderBeanInfo() {
050: super ("titledBorder", javax.swing.border.TitledBorder.class); // NOI18N
051: }
052:
053: @Override
054: protected PropertyDescriptor[] createPropertyDescriptors()
055: throws IntrospectionException {
056: PropertyDescriptor[] pds = new PropertyDescriptor[] {
057: createRW(TitledBorder.class, "border"), // NOI18N
058: createRW(TitledBorder.class, "title"), // NOI18N
059: createRW(TitledBorder.class, "titleJustification"), // NOI18N
060: createRW(TitledBorder.class, "titlePosition"), // NOI18N
061: createRW(TitledBorder.class, "titleColor"), // NOI18N
062: createRW(TitledBorder.class, "titleFont"), // NOI18N
063: };
064: pds[2]
065: .setPropertyEditorClass(JustificationPropertyEditor.class);
066: pds[3].setPropertyEditorClass(PositionPropertyEditor.class);
067: return pds;
068: }
069:
070: public static class PositionPropertyEditor extends
071: BISupport.TaggedPropertyEditor {
072: public PositionPropertyEditor() {
073: super (
074: new int[] { TitledBorder.DEFAULT_POSITION,
075: TitledBorder.ABOVE_TOP, TitledBorder.TOP,
076: TitledBorder.BELOW_TOP,
077: TitledBorder.ABOVE_BOTTOM,
078: TitledBorder.BOTTOM,
079: TitledBorder.BELOW_BOTTOM },
080: new String[] {
081: "javax.swing.border.TitledBorder.DEFAULT_POSITION", // NOI18N
082: "javax.swing.border.TitledBorder.ABOVE_TOP", // NOI18N
083: "javax.swing.border.TitledBorder.TOP", // NOI18N
084: "javax.swing.border.TitledBorder.BELOW_TOP", // NOI18N
085: "javax.swing.border.TitledBorder.ABOVE_BOTTOM", // NOI18N
086: "javax.swing.border.TitledBorder.BOTTOM", // NOI18N
087: "javax.swing.border.TitledBorder.BELOW_BOTTOM" // NOI18N
088: }, new String[] { "VALUE_PosDefault", // NOI18N
089: "VALUE_PosAboveTop", // NOI18N
090: "VALUE_PosTop", // NOI18N
091: "VALUE_PosBelowTop", // NOI18N
092: "VALUE_PosAboveBottom", // NOI18N
093: "VALUE_PosBottom", // NOI18N
094: "VALUE_PosBelowBottom", // NOI18N
095: });
096: }
097: }
098:
099: public static class JustificationPropertyEditor extends
100: BISupport.TaggedPropertyEditor {
101: public JustificationPropertyEditor() {
102: super (
103: new int[] { TitledBorder.DEFAULT_JUSTIFICATION,
104: TitledBorder.LEFT, TitledBorder.CENTER,
105: TitledBorder.RIGHT, TitledBorder.LEADING,
106: TitledBorder.TRAILING, },
107: new String[] {
108: "javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION", // NOI18N
109: "javax.swing.border.TitledBorder.LEFT", // NOI18N
110: "javax.swing.border.TitledBorder.CENTER", // NOI18N
111: "javax.swing.border.TitledBorder.RIGHT", // NOI18N
112: "javax.swing.border.TitledBorder.LEADING", // NOI18N
113: "javax.swing.border.TitledBorder.TRAILING", // NOI18N
114: }, new String[] { "VALUE_JustDefault", // NOI18N
115: "VALUE_JustLeft", // NOI18N
116: "VALUE_JustCenter", // NOI18N
117: "VALUE_JustRight", // NOI18N
118: "VALUE_JustLeading", // NOI18N
119: "VALUE_JustTrailing", // NOI18N
120: });
121: }
122: }
123:
124: }
|