What part of code in a JavaBean gets executed at design time?

John Zukowski

In theory, any of it can. It all depends on the tool you are using. For instance, if you are designing your code in emacs/vi (an editor), then none of it. If instead, you are designing with an IDE like JBuilder, then the tool may call the constructor (unless you load it from a .ser file), and whatever methods you tell it to call, to display the component in the visual designer. If you are interested in limiting what code is executed at design time, you can check with Beans.isDesignTime(). That way, if something is time consuming at runtime, you can limit what it does at design time.