Netbeans自定义折叠代码

本文介绍如何使用特殊注释创建自定义代码折叠区域,包括默认折叠状态及描述设置,适用于Java等语言。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

只需要在模块开始注释以//<editor-fold>开始,

在模块结束行以 //</editor-fold>结束即可

 

Can I Create Custom Code Folds?

 

Apart from usual folds, you can define custom folds. To add your custom fold, type in two special comments as shown in this example:

 

// <editor-fold>
   Your code goes here...
// </editor-fold>

 

You may define the default description of a collapsed fold by adding a "desc" tag:

 

// <editor-fold desc="This is my super secret genius code.">
   Your code goes here...
// </editor-fold>

 

You may set a fold to be collapsed by default by adding a "defaultstate" tag:

 

// <editor-fold defaultstate="collapsed">
   Your code goes here...
// </editor-fold>

 

Please note that the above examples are for java language. In other languages custom folds may not be supported or you may have to use different characters for marking line comments. Also <editor-fold/> element syntax is not a real XML, we use a simple regex to find your custom folds in a document, which means that there are limitations in the syntax. The most important one is that attributes may only be combined in this specific order: defaultstatedesc.

 

转载于:https://www.cnblogs.com/endtel/p/5690642.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值