jbInit and exception

Y

Yin99

JBuilder declares the GUI building method "jbInit()" with "throws"
keyword so you have to surround it with try catch.

My question, is this necessary? I would like to get rid of throws
keyword, and call jbInit() with no exception handling. Are exceptions
such a common issue when drawing a swing GUI that it is wise to have
this "throws" in jbInit? Thanks,

Yin99
 
D

dar7yl

Yin99 said:
JBuilder declares the GUI building method "jbInit()" with "throws"
keyword so you have to surround it with try catch.

My question, is this necessary? I would like to get rid of throws
keyword, and call jbInit() with no exception handling. Are exceptions
such a common issue when drawing a swing GUI that it is wise to have
this "throws" in jbInit? Thanks,

This is Borland's interpretation of the beans interface, so they can hook
up to their GUI builder. If you don't like it, you are more than welcome
to merge the jbInit into your constructor.

The exception handling is there to catch initialization errors. If you are
confident with your program, you can remove it, but your program is now
more vulnerable to unanticipated errrors. Especially if you are relying on
Borland's gui builder to produce good code.

Exceptions are the only mechanisms to report errors in constructors, as
there is no return value from a constructor. You can surround 'new'
statements with try/catch and exceptions that you wish to handle can
be dealt with.

regards,
Dar7yl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top