Is there any way to attach a field portrayal to a Display2D such that it
appears in the "layers" popup menu but is off by default?

I can see how the mechanism works; the FieldPortrayal2DHolder instance
contains the actual menu item, and the menu item is given an
ActionListener which sets the 'draw' field depending on the new state of
the menu item. But the initial state appears to be hardcoded:

menuItem = new JCheckBoxMenuItem(name,true);

One option, I suppose, would be to subclass Display2D and override that
constructor as well as Display2D.attach(), so that the initial state was
controlled by a parameter. But have I missed something, is there a nicer
way to do this?


Rob Alexander
Research Associate, Dept of Computer Science, The University of York,
York, YO10 5DD, UK
Tel: 01904 432764 Fax: 07976 889545