Subclass-matisse-panel
From ebxmlrr
How to Create a Subclass of a NetBeans Matisse Generated Form
This page describes how to create a Matisse generated form in NetBeans 6 and then create another Matisse generated form as its sub-class.
Thanks to Wade, Karthik and others on nbusers list for their help in compiling this page. The actual thread is here.
Note the steps are still being debugged and not working yet. At present when the UI is run it does not show any components from the BaseForm.
I am guessing that something special needs to be done to DerivedForm to tell it to use the BaseForm's containerDelegate as its components parent.
- Created a base form using Matisse in a class called BaseForm.
- Add components to the BaseForm using Matisse
- Add a JPanel with variableName containerDelegate using Matisse (not manually) to serve as parent for sub-class' components:
- private javax.swing.JPanel containerDelegate;
- Manually add the following to the BaseForm class:
>
- public java.awt.Container getContainerDelegate() {
- return containerDelegate;
- }
- Create a BaseFormBeanInfo class in same package as BaseForm as shown below.
>
- public class BaseFormBeanInfo extends SimpleBeanInfo {
- private BeanDescriptor bdesc = null;
>
- @Override
- public BeanDescriptor getBeanDescriptor() {
- BeanDescriptor ret = null;
- if (bdesc == null) {
- ret = super.getBeanDescriptor();
- if (ret == null) {
- ret = new BeanDescriptor(getClass());
- }
- ret.setValue("containerDelegate", "getContainerDelegate");
- bdesc = ret;
- } else {
- ret = bdesc;
- }
- return ret;
- }
- }
>
- Create a new form using Matisse in a class called DerivedForm
- Add components to the DerivedForm using Matisse
- Manually edited DerivedForm to now extend BaseForm instead of JPanel
>
- public class DerivedForm extends BaseForm {
- ....
- }
- Ran a main class that instantiated the DerivedForm in a frame.
