Idea commonly used tips summary, Java novice must be on the road, get in the car( (continuous update)

Amo Xiang 2021-08-10 03:51:12 阅读数:89

本文一共[544]字,预计阅读时长:1分钟~
idea commonly used tips summary

One 、 Download install activate IDEA

Double click the downloaded program , As shown in the figure below , Click on 【Next】 Button :
 Insert picture description here
Click on 【Browse】 Button , Select the installation directory , Note that there must be at least 2G Storage space :
 Insert picture description here
After selecting the installation directory , Click on 【next】 Button , Go to the next step . According to the number of bits of your operating system , Check accordingly , It's usually 64 position , Leave the rest as default , Click... Again after checking 【Next】 Button :
 Insert picture description here
Just click Install Button to install :
 Insert picture description here
Wait until the progress bar is full , The installation is complete :
 Insert picture description here
Check on 【Run IntelliJ IDEA】 Then click 【Finish】, Start immediately IDEA, If unchecked, the installation is completed but will not start immediately :
 Insert picture description here
start-up IDEA after , As shown in the figure below :
 Insert picture description here
If this is the first installation , select Do not import setting, If you have previously saved the corresponding settings elsewhere , Then check the first
individual , Then import the configuration , Click on ok Then go to the next step , As shown in the figure below :
 Insert picture description here
 Insert picture description here
single click OK after , Appear below , We choose Evaluate for free Try it out , After clicking on Evaluate:
 Insert picture description here
Click on Accept:
 Insert picture description here
In the pop-up interface, select the corresponding theme black on the left and white on the right , After choosing , Click on 【Next:Default plugins】:
 Insert picture description here
When selecting the default plug-in , Select on demand , Generally, all reservations can also be , Then click on 【Next:Featured plugins】:
 Insert picture description here
Select the corresponding featured plug-ins as needed , After clicking on 【Start using Intellij IDEA】:
 Insert picture description here
Finally, please support genuine activation , Here I will not repeat !!!

Two 、IDEA Description of installation directory structure

Open the installation directory C:\Program Files\JetBrains\IntelliJ IDEA 2018.1:
 Insert picture description here
bin: Execution file and startup parameter configuration file
help: Shortcut document
jre64:64 position java Running environment
lib:IDEA Rely on various class libraries
license: Individual plug-in license
plugins: Various installed plug-ins
redist: IDEA The index mechanism of redist The library catalog

3、 ... and 、 Quick start Hello Word

open IDEA, Click on 【Create New Project】:
 Insert picture description here
choice java project , At this point, the of the project JDK It's not set ,IDEA Will prompt No SDK, Click here NEW, Select local JDK Installed Directory , After clicking on ok:
 Insert picture description here
 Insert picture description here
Then click on 【Next】:
 Insert picture description here
Check Create project from template, After clicking on 【Next】 Button :
 Insert picture description here
Fill in the project name , Select the project storage location , After clicking on 【Finish】 Button :
 Insert picture description here
 Insert picture description here
Project creation completed , Click the run button in the upper right corner , Run the program :
 Insert picture description here

Four 、 newly build package and class

newly build package, Right click src Catalog , choice New–》package:
 Insert picture description here
Enter the package name to be created in the pop-up box and click ok:
 Insert picture description here
After the new is completed, you can src You can see the new package under the directory :
 Insert picture description here
newly build class, Right click any package name , choice new—》Java class:
 Insert picture description here
Fill in the corresponding Name, Choose the appropriate type :
 Insert picture description here

  1. Class: ordinary java class
  2. Interface: Interface
  3. Enum: Enumeration class
  4. Annotation: annotation
  5. Singleton: Create a single instance

Adjust the display structure of the package , The default package display structure :
 Insert picture description here
Click on the gear , Check flatten package:
 Insert picture description here
The structure of the package after modification :
 Insert picture description here

5、 ... and 、IDEA Panel overview

 Insert picture description here

6、 ... and 、IDEA Common settings

How to enter the settings panel : Using shortcut keys Ctrl + alt + s( Shortcut keys may sometimes conflict ) perhaps File—>Settings, After entering the settings panel , See the following :
 Insert picture description here
Appearance & Behavior Appearance and behavior : Configure theme 、 typeface 、 Font size 、 Tool classes and other view tools
keymap Shortcut key : Use this page to create , Edit and delete custom keyboard mappings for a specific environment , And change the shortcut keys associated with the operation .
Editor Editor : Editor related , It mainly includes common settings 、 typeface 、 Templates, etc
Plugins plug-in unit : Mainly related to plug-ins
Version Control version control : Related to version control , Include csv、git、svn etc.
Build,Execution,DeployMent structure , perform , Deploy : Heel construction , perform , Some settings related to deployment
Languages & FrameWorks Language and framework : Language and framework related settings , All kinds of languages
Tools Toolset : Various toolset settings , Including but not limited to browser 、ssh Terminals, etc

6.1 Custom background and font size settings at will

stay IDEA in , Hold down ctrl+shitf+a, Enter... In the corresponding pop-up window set, double-click set Background Image:
 Insert picture description here
The following interface appears :
 Insert picture description here
① Select the background image
② Adjust transparency
③ Set whether the background image is only for the current project ( If checked, it will only be used for the current project )
④ The location shown in the background picture
⑤ Results the preview
⑥ Clear the background of the current setting and close

Set font size , Press ctrl+alt+s Go to the settings panel , Get into Editor–》Font, modify Font as well as Size size , After clicking on Apply, At Click OK button , As shown in the figure below :
 Insert picture description here
Effect after change :
 Insert picture description here

6.2 Develop necessary code tips, ignore case

Press ctrl+alt+s Go to the settings panel , Get into Editor–》General–》Code Completion Select... From the drop-down box None:
 Insert picture description here
All Indicates that the code contains the string you entered , Case sensitive
None Indicates that the code contains the string you entered , Case insensitive
First letter Means to match the string you entered from the first letter , Case sensitive

6.3 Develop the necessary setting automatic package guide function

Press ctrl+alt+s Go to the settings panel , Get into Editor–》General–》auto import, Check the blank on the right , After clicking on ok:
 Insert picture description here

6.4 Necessary code indentation and global UTF-8 Set up

Press ctrl+alt+s Go to the settings panel , Get into Editor–>Code Style --> java
 Insert picture description here
Do not choose Use tab character,Indent keep 4.

overall situation UTF-8, Press ctrl+alt+s Go to the settings panel , Get into Editor–>File Encodings,
 Insert picture description here

7、 ... and 、 Shortcut key for fast coding

Common shortcut keys necessary for daily development :

Accept the corresponding prompt to complete Tab Copy Ctrl+c
Copy the current line to the next line Ctrl+d Paste Ctrl+v
Select the content to paste ctrl+shift+v shear Ctrl+x
Delete the line where the current target is located Ctrl + y undo Ctrl+z
Undo Ctrl+Shift+z Single-line comments Ctrl + /
Multiline comment Ctrl + Shift + / Move the current line up alt +Shift + ↑
Move down the current line alt +Shift + ↓ Move the contents of the current line to the left Shift + Tab
Move the contents of the current line to the right Tab formatting code Ctrl + alt+ L
Return to the previous edited page alt + ← Enter the next editing interface alt + →
toggle case Ctrl + Shift + u Generate setter、getter etc. alt+insert
Quickly generate return values Ctrl+alt+v Guide pack , Implement the methods in the interface alt+enter
Quickly jump to the wrong place f2 Quickly jump to the last mouse stop ctrl+alt+←
Quickly jump to the next mouse stop ctrl+alt+→ Quickly generate branches 、 loop 、 Code blocks such as exception handling Ctrl+Alt+t
Open the recently modified file ctrl+e Inject common code ctrl+j

Query file 、 Common shortcut keys for code :

Find the contents of the current file Ctrl+f Find and replace the contents of the current file Ctrl + r
Global search for file content Ctrl+Shift+f Search and replace file contents globally Ctrl+Shift+r
lookup All the files 、 Method , And ignore the contents of the file double click shift
lookup java file Ctrl + n Search for non java file , Such as yml,properties etc. Ctrl+Shift+n

Quick refactoring shortcuts :

See where the method is referenced ctrl+Alt+h Fast extraction method ctrl+Alt+m
Quickly rename the class name 、 Method name shift+f6 Jump to the concrete implementation of an interface or abstraction ctrl+alt+b

compile 、 Operational correlation 、debug Shortcut keys :

Run the current class ctrl+shift+f10 Run the currently selected shift+f10
Recompile the current class ctrl+shift+f9 choice debug Alt+Shift+f9
Get into debug shift+f9 To terminate the program ctrl+f2

7.1 Modify default shortcut keys and user-defined shortcut keys for basic skills

Press ctrl+alt+s Go to the settings panel , If you don't want to use IDEA Default shortcut , You can choose the corresponding shortcut according to your habits :
 Insert picture description here
Search the shortcut keys for the corresponding function :
 Insert picture description here
Custom shortcut , Find the function you want to add shortcut keys , Then double click :
 Insert picture description here
Add Keyboard Shortcut: open “ Enter the keyboard shortcut ” Dialog box , You can specify the keystroke combination to assign to the selected operation in the current key map .
Add Mouse Shortcut: open “ Enter mouse shortcut ” Dialog box , You can specify the combination of mouse clicks and the button to assign to the selected action in the current key mapping .
Add abbreviation: Add one that can search everything ( double-click shift) when , Phrases you can find .

版权声明:本文为[Amo Xiang]所创,转载请带上原文链接,感谢。 https://car.inotgo.com/2021/08/20210810035001571X.html