Skip to main content

Netbeans 6.0 - Code generation


The Java editor is capable of generating often used constructs for you automatically. Press Alt+Insert to invoke the code generation menu and pick what you want to generate

To add import statements: Use error hints: Click on the error mark with the light bulb or press Alt+Enter. It will offer you a list of possible classes to import. Pick the proper hint and you are done

Use the import class dialog: Put the caret into the name of an unimported class and press Alt+Shift+I. A list of possible classes to import will appear. Use the smart fix import: Press Ctrl+Shift+I. You will get a dialog that lists all unresolved identifiers in the source. If there is more than one option for resolving the identifier you may choose using the combo box. Classes shown in gray do not fit for some reason.

Method exit points: Putting the caret on the return type of a method definition will highlight all places where the method can exit

Exception throwing points: Putting the caret on an exception in a method declaration throws clause will highlight all the places where that exception can be thrown

If you want to surround a piece of text with a template, just select the text and invoke hints with Alt+Enter

Sometimes it is useful to select text based on Java syntax. To do this, press Alt+Shift+PERIOD (Ctrl-Shift-PERIOD on a Mac) to expand the selection and Alt+Shift+COMMA (Ctrl-Shift-COMMA on a Mac) to shrink the selection based on the structure of your Java source code

How to use Live Templates

Type a few letters from the name of the template e.g. fo| and invoke the code completion.
Pick the template you want to use. If there is a suitable collection it will be filled in for you. Several parts of the template will be rendered in blue. You may cycle between them using the Tab key. Editing the fields will change the part of the code accordingly. Press Enter or Esc to finish editing the template. Notice that if you move out of the blue boxes with the cursor the "edit template mode" continues (so you may get back using the Tab key) until you actually change text outside of the blue box.

Creating a new template You can define new templates: go to Menu->Tools->Options, then choose the Editor category and the Code Templates tab. You may want to look at the existing Java templates and try to create your own

Javadoc popup window Put the caret on a symbol of choice and press Ctrl+Shift+Space. Javadoc view window Go to Window->Javadoc View in the main menu. This will open a separate window which always shows Javadoc for the element under the caret

Opening a type in the editor If you know the name of the type (class, interface, annotation or enum) you want to open, press Alt+Shift+O and type the name into the dialog. Notice that you can use prefix, camel case and wild cards

Navigating to source or declaration Place the caret on a type or variable name and press Alt+O or Alt+G. The former will open the source declaration of the type in the editor; the latter will take you to the declaration (e.g. to the place where a variable is defined.) Hyperlinking A similar action can be achieved by holding down the Ctrl key and clicking on an element with the mouse.

Implements/Overrides annotation Methods which implement or override another method are marked with a glyph in the editor gutter. Clicking the icon will take you to the overridden method or to the method from the interface. Pressing Ctrl+B does the same.

Declaration Window If you want to see the declaration of a given element but you don't want to open it in the editor, you can open the Declaration View, which always shows the declaration of the element under the caret

Comments

Popular posts from this blog

Artist got automated

Here is my first Tensorflow run to convert images to different styles of famous painters I am using the code that is available at  https://github.com/lengstrom/fast-style-transfer It uses specific versions of below libraries !apt install ffmpeg !pip install tensorflow==0.12.1 !pip install numpy==1.11.2 !pip install scipy==0.18.1 !pip install pillow==3.4.2 I started with latest version and that triggered failure after failure. If you are like me, add below changes to their respective files #This is to make tensorflow behave as if it is in v1 File : evaluate.py and ./src/transform.py import tensorflow.compat.v1 as tf tf.disable_v2_behavior() #Image functions are removed from scipy.misc module. so use imageio instead import imageio scipy.misc.imsave(out_path, img) --> imageio.imwrite(out_path, img) img = scipy.misc.imread(src, mode='RGB') --> img = imageio.imread(src, pilmode='RGB') Refer this post on more details on imageio changes Here is the ...

OnePlus 6T - Android 10 (OOS 10)

Its been more than 3 months since August security patch update. Out of curiosity I checked Oxygen Updater. To my surprise, Oxygen OS v 10 (based on Android 10) is available. Since this is a stable release, i went head and updated it. Its ended up being a buggy release. For those of you, who didnt get update over OTA, its better to wait for OOS 10.1. Here are the list of issue and the workarounds. Issue #1 :  Phone randomly restarts and then goes to boot loop Workaround : when the phone stuck in boot loop (with OnePlus logo animation), Press Power Button and Volume Down button to restart it Issue #2 : Google play wont work Work Around : Booting to recovery and clearing cache is expected to fix this. will update after testing To booting to recovery, Firstly, turn off your phone: press and hold the Power button for a while or press the Power key once and choose ‘power off’. Once the switch off process is completed start pressing and also holding down the Volume Dow...