How Does it Work?

I just created my first Swing form using IntelliJ. Seems pretty cool. But there is obviously some magic going on.

Based on the code I am seeing, I should be getting a null pointer exception on this line:

frame.setContentPane(occurrencePanel.topPanel);

But it somehow seems to work.

Is there some kind of aop thing going on? Will this run outside of IntelliJ. Do I need any special jar files?

1 comment
Comment actions Permalink

IDEA use a kind of byte code injection to inject the codes that generate the layout/components of your form. those codes are static blocks and will run before your normal constructor. There is a setting that can generate all codes into your source, but normally unless you are going to share code with some one who does not use idea, you won't do it.

0

Please sign in to leave a comment.