This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 183336 - CustomProperty Editor example does not work properly
Summary: CustomProperty Editor example does not work properly
Status: NEW
Alias: None
Product: usersguide
Classification: Unclassified
Component: IDE (show other bugs)
Version: -S1S-
Hardware: PC Linux
: P3 normal (vote)
Assignee: issues@mobility
Depends on:
Reported: 2010-04-01 10:22 UTC by toki78
Modified: 2011-11-16 16:40 UTC (History)
1 user (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description toki78 2010-04-01 10:22:11 UTC
I tried out your example
Unfortunately it doesn't work. The editor does not store the value.
I applied some minor changes, but I'm not sure, if this is Netbeans conformant.

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyEditor;
import java.beans.PropertyEditorSupport;
import java.lang.reflect.InvocationTargetException;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.KeyStroke;
import org.openide.explorer.propertysheet.ExPropertyEditor;
import org.openide.explorer.propertysheet.InplaceEditor;
import org.openide.explorer.propertysheet.PropertyEnv;
import org.openide.explorer.propertysheet.PropertyModel;
import org.openide.util.Exceptions;

 * @author thorsten
public class RahmenstilPropertyEditor extends PropertyEditorSupport
        implements ExPropertyEditor, InplaceEditor.Factory {

    private static final String[] values = new String[]{
        "none", "dotted", "dashed", "solid", "double",
        "groove", "ridge", "inset", "outset"};

    public String getAsText() {
        return getValue().toString();

    public boolean supportsCustomEditor() {
        return false;

    public void setAsText(String text) throws IllegalArgumentException {

    public void attachEnv(PropertyEnv pe) {
    private Inplace ed = new Inplace();

    public InplaceEditor getInplaceEditor() {
        if (ed == null) {
            ed = new Inplace();
        return ed;

    private class Inplace implements InplaceEditor, ActionListener {

        private PropertyEditor editor = null;
        private PropertyEnv propertyEnv = null;
        public JComboBox cb = new JComboBox(values);
        private PropertyModel model = null;

        public void connect(PropertyEditor propertyEditor, PropertyEnv env) {
            editor = propertyEditor;
            propertyEnv = env;

        public JComponent getComponent() {
            return cb;

        public void clear() {
            //avoid memory leaks:
            editor = null;
            model = null;

        public Object getValue() {
            try {
                return model.getValue();
            } catch (InvocationTargetException ex) {
                return null;

        public void setValue(Object object) {
            try {
            } catch (InvocationTargetException ex) {

        public boolean supportsTextEntry() {
            return false;

        public void reset() {

        public KeyStroke[] getKeyStrokes() {
            return new KeyStroke[0];

        public PropertyEditor getPropertyEditor() {
            return editor;

        public PropertyModel getPropertyModel() {
            return model;

        public void setPropertyModel(PropertyModel propertyModel) {
            model = propertyModel;

        public boolean isKnownComponent(Component component) {
            return component == cb || cb.isAncestorOf(component);

        public void addActionListener(ActionListener actionListener) {

        public void removeActionListener(ActionListener actionListener) {

        public void actionPerformed(ActionEvent e) {
            try {
            } catch (InvocationTargetException ex) {

Best Regards
Thorsten Kiefer
Comment 1 Irina Filippova 2010-04-01 16:16:37 UTC
Assigning to Geertjan for evaluation. Geertjan, can you please take a look?
Comment 2 Geertjan Wielenga 2010-04-01 22:29:23 UTC
You're by no means the first person to have followed the tutorial. Anyway, reassigning this to Tim Boudreau, who wrote the tutorial.
Comment 3 Geertjan Wielenga 2010-04-01 22:30:23 UTC
And, by the way, here is the current version of the tutorial:
Comment 4 _ tboudreau 2011-05-26 02:44:48 UTC
Uy... I *am* the default assignee for javacard...