当前页面: 开发资料首页 → Netbeans 专题 → Customize Your NetBeans Java Template to Fit Your Need
摘要: NetBeans comes with generic class templates. Often times though, you may find yourself retyping or cutting-and-pasting the same generic text every time you try to create a new class (such as your company's copyright text, disclaimer, etc).
Wouldn't it be nice to have NetBeans create a java class that already has the information there? Yes, this can be done quite easily. Customized template to the rescue!
Let say you want to create a customize java class template with your company's information. Here are the steps to set it up (and these steps also apply to customize Java interfaces, applets, etc.) so here we go
Click Next on the following pop-up window

and voil??! your new java class template appears

/*
* __NAME__.java
*
* Created on __DATE__, __TIME__
*
* Copyright(c) {YEAR!!!} XYZ Company, Inc. All Rights Reserved.
* This software is the proprietary information of XYZ Company.
*
*/
package Templates.Classes;
import org.xyz.whatever // Place any imports that are common
// to most of your classes
import org.xyz.util.Logger; // Logging library, for example.
/**
* {Insert class description here}
*
* @version $Revision: 1.4 $
* @since Build {insert version here} (MM YYYY)
* @author John Doe
* @author $Author: jcatchpoole $, (this version)
*/
public class XYZCompany
{
private static final String PVCS_ID = "@(#)$Header: /cvs/testwww/www/kb/articles/customize-java-template.html,v 1.4 2005/12/28 15:35:23 jcatchpoole Exp $";
private static final Logger log = Logger.getLogger (__NAME__.class);
private static final String CLASS_NAME = "__NAME__";
/**
* Creates a new instance of __NAME__
*/
public XYZCompany ()
{
}
/**
* Add other methods here ...
*
* @param value1
* @param value2
*
* @return
*
* @throw
*/
// public void helloWorld()
// throws whateverException
// {
// }
} // end __NAME__