I have been using JavaBeans for a while and have been able to add custom PropertyEditors and such like so am reasonably proficient with the API.
What I would like to do now is to be able to nest one JavaBean inside another so that you click on the top one in the IDE
and it expands to show the properties of the sub bean (a bit like the layout constraints nested in a panel bean for example).
What I am not sure about is how to structure this in the code so that the IDE recognises it and displays the beans accordingly.
Does anyone know how to do it?
You need to look up inner classes in the tutorial. Once you have the inner class, then you need to make your outer class have a getter to read the properties of the inner. You will not be able to see the inner other than through a getter or handoff through a getter.
What I was looking for was the ability to see this nested effect in the IDE. I am using JFormDesigner, so I contacted their support team and they told me this
type of thing is not currently supported in either JFormDesigner or NetBeans. They looked in to adding it but concluded it would be too much work.
So what we currently have is several different beans all implementing the same interface and we're seeing a lot of duplicate code.