eclipse常用设置----中文乱码、行数显示、缩进方式、行末空格和空行自动删除、常用注释、背景色

一、中文乱码

  window系统下,Eclipse中导入新的项目的时候,可能会遇到中文乱码的问题。

  解决方案:将系统默认的格式为GBK改成UTF-8。以下是具体解决方法,可以根据需要选择不同的方法。

1、设置整个工作空间的编码,此操作会影响整个工作空间的项目。

  设置步骤:菜单栏window --  Preferences -- General -- Workspace --Text file encoding--Other --UTF-8,保存配置(Apply and Close)。

2、设置项目的编码,此操作只影响被选中项目。

  设置步骤:选中项目右键 -- Properties -- Resource --Text file encoding--Other --UTF-8,保存设置。

 

3、设置单个文件的编码,此操作只影响被选中文件。

  设置步骤:选中文件右键 -- Properties -- Resource --Text file encoding--Other --UTF-8,保存设置。

 

二、eclipse中显示代码行数、空格(space)和制表符(tab)

未设置前:

设置步骤: 菜单栏Window -- Preferences -- Gerenal -- Editors -- Text Editors,保存设置。(显示行数也可以直接用Ctrl+F10, 然后勾选Show Line Numbers)

设置后:

三、设置缩进方式(一个tab为四个空格)

设置步骤:1)、设置缩进:菜单栏Window -- Preferences -- Gerenal -- Editors -- Text Editors--Insert spaces for tabs,保存设置;

2)、将tab为4个空格配置到formatter中:

i)、菜单栏Window -- Preferences -- Java -- Code Style -- Formatter;

ii)、新建一个文件,配置如下所示,保存;

iii)、Source -- Format,进行格式化。

四、保存(Ctrl+S)时自动删除行末空格以及空行

设置前:

设置步骤:Window -- Preferences -- Java -- Editor -- Save Action -- Perform the ... -- Additional actions -- Configure... -- Remove trailing whitespace -- All lines

 

 

设置后:

五、常用注释

设置步骤:菜单栏Window -- Preferences -- Java -- Code Style --Code Templates -- Comments 

1、Files -- Edit 

/**   
 * @Description: 
 * @Package ${package_name} 
 * @Title: ${file_name}
 * @author sucb
 * @date ${date}
 */

2 、Types -- Edit 

 

/**@Description: 
 * @Package ${package_name} 
 * @Title: ${file_name}
 * @author sucb
 * @date ${date}
 */

3、Methods -- Edit

/**
 * ${tags}
 * @author sucb
 * @date ${date}
 */

六、背景色(其他颜色类似设置)

设置步骤:菜单栏Window -- Preferences -- General -- Editors --Text Editors -- Background color,去掉默认设置的勾选,双击Color后的颜色框;

 选个你喜欢的背景色

设置后:

 

 

如果有写的不对的地方,请大家多多批评指正,非常感谢!

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值