This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 200929 - GUI builder calling class code
Summary: GUI builder calling class code
Status: RESOLVED INVALID
Alias: None
Product: guibuilder
Classification: Unclassified
Component: App Framework (show other bugs)
Version: 7.0
Hardware: PC Windows 7 x64
: P4 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-13 23:43 UTC by supuhstar
Modified: 2011-11-16 16:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description supuhstar 2011-08-13 23:43:26 UTC
Product Version = NetBeans IDE 7.0 (Build 201104080000)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0-ea
Runtime = Java HotSpot(TM) 64-Bit Server VM 20.0-b03

I am using the GUI builder to build a JFrame for a class (simply called GUI.class) that extends BHFrame (a class of mine which, in turn, extends JFrame). When opening the GUI builder opens for my GUI class, it seems to call the constructor for BHFrame. I only noticed this because it did the hilarious, yet innocent act of changing NetBeans' LAF to Metal and recoloring it to my "Mocha" color scheme using the recoloring algorithm coded into my BHFrame class. A screenshot is here: http://s.supuhstar.operaunite.com/s/content/images/misc/Mocha%20NetBeans.png
Comment 1 Jan Stola 2011-08-15 09:02:43 UTC
This is as designed, of course. GUI Builder has to instantiate all components/beans to be able to show them, display their properties (including default values), etc.

If your component/bean contains some code whose execution inside IDE is problematic then you should use java.beans.Beans.isDesignTime() to find out whether your bean is inside IDE or not.

In other words, your code should look like

if (!Beans.isDesignTime()) {
    // Do whatever IDE doesn't like
}