There are several code generation preferences that you
can set for the visual editor for Java™.
About this task
To specify code generation preferences:
Procedure
- From the main menu, click to open the visual editor preferences.
- On the Code Generation page, you can select the following
preferences:
- Generate try{}catch() block
- Generate a comment for new expressions
The following code shows a JPanel initialized with the try{}catch() block:private JPanel getJPanel1() {
if (jPanel1 == null) {
try {
jPanel1 = new JPanel();
}
catch (java.lang.Throwable e) {
// TODO: Something
}
}
return jPanel1;
}
The following code shows a JPanel without the try{}catch() block
of code:private JPanel getJPanel() {
if (jPanel == null) {
jPanel = new JPanel();
}
return jPanel;
}
The following line of code is an example of what the
generated comment looks like:this.add(getJPanel(), null); // Generated
- Click OK to save your changes and
close the Preferences window.