How to place cursor in NetBeans Java file template

2019-06-24 10:16发布

问题:

I would like to have the cursor in the JavaDoc area when creating interfaces, classes, etc. in NetBeans. You can use ${cursor} for non-file-based templates, but this doesn't work for file templates.

<#if package?? && package != "">
package ${package};

</#if>
/**
 * ${cursor}     <-- Inserts a message that "cursor" is an unknown variable. :(
 *
 * @author ${user}
 */
public class ${name}
{

}

Is there a similar mechanism for file templates?

回答1:

For some reason this feature hasn't been implemented (yet). See this issue for details.