Apache NetBeans
Apache NetBeans
Latest release

Apache NetBeans 24

Download

How do I change the default behavior of PropertySheet editors?

Issue: How do I specify the kind of renderer which will represent the look of property value cell (in the same manner as it usually does for JTable)? For example, I want a string property not to be shown in grey if it’s not editable. Solution: If you specify a custom inplace editor it will also be used for rendering.

Issue: How can I provide a new kind of inplace editor? For example, I want to have a property which should be shown at Property Sheet like a combo-box or a spinner control. Solution: See the docs for the InplaceEditor interface.

Issue: How do I specify that a value is not editable in-place? Solution: Provide a custom inplace editor that provides a disabled component for the inplace editor. Or mark it non-editable, but supply a custom editor that does edit it.

Issue: How do I specify that a property has a custom editor? Solution: See the docs for the PropertyEditor interface.

Issue: How can I copy text from a non-editable property? Solution: If the non-editable property has a Custom editor ('…​' button) you can easily use Ctrl+c on content of a Custom editor. If the non-editable property doesn’t have a Custom editor you can select property cell and press Ctrl+c, but whole line is copied (property name and value).

Issue: How do I access the Node the property belongs to? Solution:

class MyEditor implements ExPropertyEditor {
  PropertyEnv env;

  public void attachEnv(e) {
    env = e;
  }

  public void anyMethod() {
     Object[] arr =  env.getBeans();
     // now arr contains either the real bean objects if invoked on Object
     // or it contains Node that the properties belong to
  }
}