![]() ![]() ![]() |
||||||||||||||||||||||||||||||
INPRISE Online And ZD Journals Present:
If you've ever tried to read someone else's Java source files, you've probably noticed that no two programmers format their source code the same way. However, most of us do try to indent nested blocks of code in a consistent manner. To assist you in formatting your source files, a number of programming text editors--Borland's old Brief editor, for example--provide a feature called column marking. Column marking allows you to select vertical regions of text that are narrower than the editor's maximum line length. In this article, we'll show how you can use the column-marking capability of the editor that's built into the JBuilder Integrated Development Environment (IDE).
Brief review However, you don't have to enable Brief emulation to take advantage of column marking--it's available any time you're using the JBuilder code editor window. If you change the keystroke mapping in JBuilder using the Environment Options dialog box, you can configure JBuilder's editing window to recognize this and other Brief commands.
Mapping at the wheel For example, if you use the Default or Classic keystroke mappings, you can press [Shift][Ctrl] and the left or right arrow key to select the previous or next word, respectively. (The Brief and Epsilon key mappings, on the other hand, don't support this style of keyboard selection.) Table A lists some of the other keystrokes you can use to select a range of text in an editing window.
Table A:
All of the keystrokes in Table A perform line-by-line selection. However, if you press [Alt] while using any of these keystrokes, you'll select a vertical column of text instead. The beginning point and ending point of the selection will be the same as before, but the editor will highlight only a region of text that appears between the horizontal location of the beginning and ending selection points. (If you select columns and move the cursor straight down, the selection will automatically be one character wide.) If you've viewed the online Help for JBuilder, you may have seen some of the keyboard shortcut information we've presented so far. However, you can accomplish the same results using the mouse. Just as you can use the left mouse button to move the insertion point and select text line-by-line, you can press [Alt] as you select text using the mouse, and you'll instantly select column regions in an editing window. In addition, you can use this technique to select columns of text even if you're using the Brief or Epsilon keystroke mappings--something you can't do from the keyboard when those mappings are active.
A pillar of [Alt] Place the cursor at the beginning of line 12 (in the middle of the class declaration). If you're using the Default or Classic keystroke mappings (you're using Default unless you've changed it), press and hold [Shift][Alt] and then press the down arrow twice. Now you'll notice that you've selected a one-character-wide column of space that indents lines 12, 13, and 14, as shown in Figure A. If you want to remove this space to shorten both lines, press [Delete]. Figure A: You can use the keyboard to select columns of text when you're using the Default or Classic keystroke mappings. Next, press [Alt], click at the beginning of line 12, and drag down to line 14. As before, you'll notice that you've selected a one-character-wide column of space that indents these two lines.
Conclusion Back to Top Back to Index of Articles Copyright © 1997, ZD Journals, a division of Ziff-Davis Inc. ZD Journals and ZD Jounals logo are trademarks of Ziff-Davis Inc. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff-Davis is prohibited. |