|Disable execution of initialize() in VE [message #484107]
||Fri, 04 September 2009 10:37
| Kaspar von Gunten
Registered: July 2009
For reasons too long to explain here, we are required to use the VE to
define panels, that extend other panels which were already designed by the
At first sight, it does of course not make sense to extend a visual bean,
because the superclass would already paint/create a GUI. But we need this,
so that the resulting subclass has the same type as the superclass and can
be used in places where this one could (i.e. use B1 extends B, use visual
bean B1 in places where B is expected).
To resolve the problem with the "double GUI definition" we attempt to turn
off the execution of the "initialize()" method in the super class. We
detect during the execution of the (super) constructor, that we are
executing the initialization of an extending panel. This is fairly easy:
public class B extends GridBagPanel
if (this.getClass() == B.class)
public class B1 extends B
if (this.getClass() == B1.class)
This works great in practice, too. If I execute this and show a B1
instance, then only initialize() of B1 will be executed, initialize() of B
will be skipped.
HOWEVER, if I open B1 in the VE, then I somehow get both GUIs painted on
top of each other, inspection shows that initialize() of B is executed?!
(During the execution of B's constructor this.getClass() is actually equal
to B.class as debugging shows).
See here: http://de.tinypic.com/r/rcqxqd/3 to get screenshots of the
behavior (sorry for the crappy site, it was the first hit in Google).
Can anyone explain this to me or suggest another way, how I can turn off
the execution/painting of initialize() in a visual bean super class?
Suggestions are greatly appreciated,
Powered by FUDForum
. Page generated in 0.01252 seconds