在 Netbeans 中编辑多行代码 [英] Editing multiple lines of code in Netbeans
问题描述
有没有办法在netbeans中选择和编辑多行代码?
Visual Studio 允许类似的操作,您可以按 alt 并使用鼠标的拖动动作(左键单击)选择多行?
Is there a way to select and edit multiple rows of code in netbeans?
Visual Studio allows a similar operation where you press alt and select multiple lines using the dragging motion (left click) of mouse ?
推荐答案
这叫做矩形选择.
它可以通过 Crtl+Shift+R
步骤截图:
彼得,2011 年 10 月 20 日
Rectangular Selection
By Petr on Oct 20, 2011
如果您使用开发构建,您可能会注意到 NetBeans编辑器添加了矩形选择动作.我不需要这个功能,但在某些情况下可能会有所帮助.之一这种情况是当您需要删除文本或代码中的行号时从教程复制过来的.如下图所示.
If you use development build, you probably noticed that NetBeans editor added Rectangular Selection action. I don't need this functionality every day, but it can be helpful in some case. One of such case is when you need to delete line numbers in a text or code copied from a tutorial. Like on the picture below.
您可以按矩形选择后选择矩形编辑器工具栏中的切换按钮或按CTRL+SHIFT+R 快捷键.
You can select the rectangle after pressing Rectangular Selection toggle button in the editor toolbar or pressing CTRL+SHIFT+R shortcut.
可以使用鼠标或键盘轻松完成选择.当你使用键盘,只需将插入符号放在角落,按住 SHIFT并使用箭头键选择所需内容.
The selection can be easily done with mouse or keyboard. When you use keyboard, just place the caret on a corner, keep down SHIFT and with the arrows keys you select what you need.
选择完成后,您可以轻松删除所有行号按 DELETE 键.然后你必须退出矩形选择模式(CTRL+SHIFT+R 或切换按钮编辑器工具栏).
When the selection is done, you can easily delete all the line numbers with pressing DELETE key. Then you have to exit from the rectangle selection mode (CTRL+SHIFT+R or toggle button in the editor toolbar).
如果你写一个文本,那么文本被放置在文本中的每一行选定区域.例如,这对于更改访问权限很有用一个类中更多字段的修饰符.
If you write a text , then the text is placed on every line in the selected area. This can be useful for example for changing access modifiers of more fields in a class at once.
这篇关于在 Netbeans 中编辑多行代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!