在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
It's called rectangular selection.
It can be enabled by 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屋!