本文共 1569 字,大约阅读时间需要 5 分钟。
导语:
NetBeans现在已经运用的越来越广泛,最新的版本是8.2版本,其中的template功能也是逐渐完善,其中就包含了头部注释的功能,默认内容如下:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */package InheritedClass;/** * * @author Arthur */public class InheritedClass { }
本教程修改的是头部和中间的注释内容。
3. 中部注释修改方法:Tool --> templates --> 展开java --> 选择java class,选择open in editor
原始文件内容如下:
<#assign licenseFirst = "/*"><#assign licensePrefix = " * "><#assign licenseLast = " */"><#include "${project.licensePath}"><#if package?? && package != "">package ${package}; /** * @author ${user} * */public class ${name} {}
将 下面内容删除,则不会出现头部注释
<#assign licenseFirst = "/*"><#assign licensePrefix = " * "><#assign licenseLast = " */"><#include "${project.licensePath}"><#if package?? && package != "">
还可以增加创建时间等变量,具体参考
4.修改用户名,即@author的内容
在上图中点击settings,原始内容如下:
## Here, or in other properties files in this directory, you can define# various properties that you want to make available to the template# processor while creating various templates.## uncomment the next line and specify your user name to be used in new templates# user=Your name
将user前面的#去掉,在your name位置添加上您的姓名,后面添加您的个人主页,如果没有就删掉,即可
欢迎评论和留言!
转载地址:http://knznb.baihongyu.com/