asdf
asdf

Reputation: 11

modify initComponents() in netbeans

I modified some of the text fields in my GUI to use constructors which throw exceptions. While the properties window of netbeans' swing designer allows me to modify the code of controls and containers, I can't see a way to modify the initComponents() method itself to throw exceptions so i would have to add try/catch blocks to many of my controls, which would be rather tedious.

Upvotes: 1

Views: 5718

Answers (1)

Boro
Boro

Reputation: 7943

Well you could try to do in a plain text editor. But this would probably break your GUI editor. The other way around it is to have a standard constructor, i.e. public A(){} and public initialize(....) methods with proper arguments which can throw the exceptions and you would call them elsewhere, e.g. just after the initComponents() methods in your code.

But even better is to learn layout managers and hand-GUI-coding yourself so you will not need to rely on GUI builders. This way you have full control over what is going on, and if your project is fairly complicated that is what you want.

Upvotes: 1

Related Questions