Wednesday, January 26, 2005


So, I just made my first multiview component. It was easier than I expected, and the source code in the minicomposer example was particularly helpful.

In fact, too helpful. Or, rather, it was so precisely what I needed, that I wonder why it was necessary for me to copy so much source code verbatim, rather than just invoking some higher level API.

If you have a file type that can be edited in 2 ways (text and some other GUI), and you've already written TopComponents for both, you can pretty much just paste in a big chunk of the minicomposer ScoreEditorSupport to your own EditorSupport, and pull in a little code from ScorePanel to your own GUI TopComponent. You may want to change the names of the buttons ("compose", for me, became "graph"). But that's about it.

Extremely simple, but not exactly the best example of code reuse.


Anonymous said...

Agree, the multiviews when used in the source+design pattern do have a high copy+paste ratio. The task to improve it is in the pipeline, but not having high priority.
Milos Kleint

Anonymous said...

Do you know if the minicomposer example works with recent 4.1 or 5.0) versions of NetBeans?