如何在java中添加注释框?

如何在java中添加注释框?,java,eclipse,comments,shortcut,box,Java,Eclipse,Comments,Shortcut,Box,我正在用java for class开发一个项目,我需要在每个方法上方添加一个注释框,解释每个方法的作用。应该是这样的: ***********星号线************************************************************************* *@param * *************另一行********************************************************************* 我正在使用

我正在用java for class开发一个项目,我需要在每个方法上方添加一个注释框,解释每个方法的作用。应该是这样的:

***********星号线************************************************************************* *@param

*

*************另一行*********************************************************************


我正在使用eclipse,我知道有一个快捷方式可以创建此框,但我似乎记不住它,或者在web上找不到它…

在主菜单窗口->首选项中 在左边的树上 Java->代码样式->代码模板
在右侧面板上选择Comments->Methods,并在主菜单窗口->Preferences的右下文本区域打印模式 在左边的树上 Java->代码样式->代码模板
在右侧面板上选择Comments->Methods并在右下角文本区域打印模式

转到eclipse>windows>preference>java>templates

单击“新建”立即为您的图案命名,并添加说明,并提供以下图案

/*****************************************************************************************
* ${cursor}This is default description for this method. Kindly remove this type the actual 
* usage and other relevant information for the method as description.
* @since    ${date}
* @param    paramName   Parameter description 
* @return   <Description of return value. Remove this tab for return type     void.>
* @throws   ExceptionClass  Description of the exception reason or  scenario
*****************************************************************************************/

/*
* Author    ${user}
* Version   <Enter the version of the product/project for this method.> 
* History   Updated By      Update Date     Update Reason
*           ==============  ===========     ================================================
*/

使用上下文作为java,现在最终显示创建任何类,然后添加方法在引入方法之前,只需开始键入上述模板的名称,然后按CTRL+SPACE并选择模板,然后读取方法的说明

转到eclipse>windows>preference>java>模板

单击“新建”立即为您的图案命名,并添加说明,并提供以下图案

/*****************************************************************************************
* ${cursor}This is default description for this method. Kindly remove this type the actual 
* usage and other relevant information for the method as description.
* @since    ${date}
* @param    paramName   Parameter description 
* @return   <Description of return value. Remove this tab for return type     void.>
* @throws   ExceptionClass  Description of the exception reason or  scenario
*****************************************************************************************/

/*
* Author    ${user}
* Version   <Enter the version of the product/project for this method.> 
* History   Updated By      Update Date     Update Reason
*           ==============  ===========     ================================================
*/

使用上下文作为java,现在最终显示创建任何类,然后添加方法在引入方法之前,只需开始键入上述模板的名称,然后按CTRL+SPACE并选择模板,然后读取方法的说明

使用JavaDoc记录每个方法并解释它们的作用、参数、返回的内容以及它可能引发的任何异常是一种很好的做法

/**
 * This is proper JavaDoc notation. It starts with a forward slash, two asterisks
 * and then an asterisk per line. When it ends, we use the combo asterisk forward slash
 */
识别参数和返回类型时,请使用@字符:

/**
 * method add2 takes an integer and adds
 * 2 to it. It then returns the new integer
 *
 * @param someInt    the integer we will add 2 to
 * @return integer   the new integer after 2 was added
 */
public int add2(int someInt) {
    int integer = someInt + 2;
    return integer;
}

使用JavaDoc记录每个方法并解释它们的作用、参数、返回的内容以及它可能引发的任何异常是一种很好的做法

/**
 * This is proper JavaDoc notation. It starts with a forward slash, two asterisks
 * and then an asterisk per line. When it ends, we use the combo asterisk forward slash
 */
识别参数和返回类型时,请使用@字符:

/**
 * method add2 takes an integer and adds
 * 2 to it. It then returns the new integer
 *
 * @param someInt    the integer we will add 2 to
 * @return integer   the new integer after 2 was added
 */
public int add2(int someInt) {
    int integer = someInt + 2;
    return integer;
}

你需要这样吗?键入/*并按ENTER您必须通过在eclipseAlt+Shift+j上配置来使用特定的注释模板您可以使用它来创建java docno而不是/*快捷方式我知道有一个快捷方式可以使整个框像这样,其中已包含@param=\@codytimer这就是我所说的由您的在eclipse中配置的公司XML文件您需要记住模板存储在哪个名称上,并在control+space之后使用该名称您需要这样做吗?键入/*并按ENTER您必须通过在eclipseAlt+Shift+j上配置来使用特定的注释模板您可以使用它来创建java docno而不是/*快捷方式我知道有一个快捷方式可以使整个框像这样,其中已包含@param=\@codytimer这就是我所说的由您的在eclipse中配置的公司XML文件您需要记住模板存储在哪个名称上,并使用该名称跟随control+spaceThank you just what I looking=Thank you just I looking=