1 执行(run) alt+r
2 提示补全 (Class Name Completion) alt+/
3 单行注释 ctrl + /
4 多行注释 ctrl + shift + /
5 向下复制一行 (Duplicate Lines) ctrl+alt+down
6 删除一行或选中行 (delete line) ctrl+d
7 向下移动行(move statement down) alt+down
8 向上移动行(move statement up) alt+up
9 向下开始新的一行(start new line) shift+enter
10 向上开始新的一行 (Start New Line before current) ctrl+shift+enter
11 如何查看源码 (class) ctrl + 选中指定的结构 或 ctrl + shift + t
12 万能解错/生成返回值变量 alt + enter
13 退回到前一个编辑的页面 (back) alt + left
14 进入到下一个编辑的页面(针对于上条) (forward) alt + right
15 查看继承关系(type hierarchy) F4
16 格式化代码(reformat code) ctrl+shift+F
17 提示方法参数类型(Parameter Info) ctrl+alt+/
18 复制代码 ctrl + c
19 撤销 ctrl + z
20 反撤销 ctrl + y
21 剪切 ctrl + x
22 粘贴 ctrl + v
23 保存 ctrl + s
24 全选 ctrl + a
25 选中数行,整体往后移动 tab
26 选中数行,整体往前移动 shift + tab
27 查看类的结构:类似于 eclipse 的 outline ctrl+o
28 重构:修改变量名与方法名(rename) alt+shift+r
29 大写转小写/小写转大写(toggle case) ctrl+shift+y
30 生成构造器/get/set/toString alt +shift + s 生成构造器:选中你要创建getter,setter的字段,然后选择generator,可以拖选住你想要生成get、set方法的属性,点击完成即可自动生成get和set方法。 (菜单栏->generator 或者 点击右键->generator)
31 查看文档说明(quick documentation) F2
32 收起所有的方法(collapse all) alt + shift + c
33 打开所有方法(expand all) alt+shift+x
34 打开代码所在硬盘文件夹(show in explorer) ctrl+shift+x
35 生成 try-catch 等(surround with) alt+shift+z
36 局部变量抽取为成员变量(introduce field) alt+shift+f
37 查找/替换(当前) ctrl+f
38 查找(全局) ctrl+h
39 查找文件 double Shift
40 查看类的继承结构图(Show UML Diagram) ctrl + shift + u
41 查看方法的多层重写结构(method hierarchy) ctrl+alt+h
42 添加到收藏(add to favorites) ctrl+alt+f
43 抽取方法(Extract Method) alt+shift+m
44 打开最近修改的文件(Recently Files) ctrl+E
45 关闭当前打开的代码栏(close) ctrl + w
46 关闭打开的所有代码栏(close all) ctrl + shift + w
47 快速搜索类中的错误(next highlighted error) ctrl + shift + q
48 选择要粘贴的内容(Show in Explorer) ctrl+shift+v
49 查找方法在哪里被调用(Call Hierarchy) ctrl+shift+h
六.模板
/* idea 代码模板所处的位置:setting -editor-live templates(更快一些)/postfix completion live templates可以修改,本人把idea里main函数的快捷键psvm修改成main了. */ public class Templates { //模板六:prsf private static final Custom cu = new Custom(); //变形:psf/psfi/psfs public static final String s = "aaa"; /*模板修改 进入live templates修改 以psfi为例 初始效果:public static final int 修改之后:public static final int $VAR1$ = $VAR2$; $END$*/ public static final int i = 0; /*模板自定义 进入live templates 点击+ , 点击Template Group , 输入name ,点击+,点击live templates,开始自定义 注意Define选择java或者其他 */ //模板一:main public static void main(String[] args) { //模板二:sout System.out.println(); //变形:soutp/soutm/soutv/xxx.sout System.out.println("args = [" + args + "]");//参数 System.out.println("Templates.main");//方法名 int ii = 1; System.out.println("ii = " + ii);//就近变量 System.out.println(222);//xxx.sout //模板三:fori String[] arr = new String[]{"001", "002", "003"}; for (int i = 0; i < arr.length; i++) { System.out.println(arr[i]); } //变形:iter for (String s : arr) { System.out.println(s); } //变形:itar for (int i = 0; i < arr.length; i++) { String s = arr[i]; } //模板四:list.for ArrayList<String> list = new ArrayList(); list.add(0, "qqq"); list.add(1, "www"); list.add(2, "eee"); for (String s : list) { System.out.println(s); } //变形:list.fori for (int i = 0; i < list.size(); i++) { } //变形:list.forr 反向遍历 for (int i = list.size() - 1; i >= 0; i--) { } //模板五:ifn if (list == null) { } //变形:inn if (list != null) { } //变形:xxx.nn/xxx.null } }
七.添加静态网络和添加tomcat部署web工程
静态网络练习完毕,下面是动态练习。
开始部署tomcat
点击run 点击Edit Configurations
点击+号,tomcat server点击local
命名,最好就写tomcat版本号,点击configure
寻找tomcat的路径。
点+号把模块添加进tomcat里
启动tomcat,动态网络练习结束