Java Swing - O Reilly selectionBackwardAction Adjust the current

Java Swing - O Reilly selectionBackwardAction Adjust the current selection by moving the caret back one position selectionBeginAction Adjust the current selection by moving the caret back to the beginning of the document selectionBeginLineAction Adjust the current selection by moving the caret back to the beginning of the current line selectionBeginParagraphAction Adjust the current selection by moving the caret back to the beginning of the current paragraph selectionBeginWordAction Adjust the current selection by moving the caret back to the beginning of the current word selectionDownAction Adjust the current selection by moving the caret down one row selectionEndAction Adjust the current selection by moving the caret to the end of the document selectionEndLineAction Adjust the current selection by moving the caret to the end of the current line selectionEndParagraphAction Adjust the current selection by moving the caret to the end of the current paragraph selectionEndWordAction Adjust the current selection by moving the caret to the end of the current word selectionForwardAction Adjust the current selection by moving the caret forward one position selectionNextWordAction Adjust the current selection by moving the caret to the beginning of the next word selectionPreviousWordAction Adjust the current selection by moving the caret to the beginning of the previous word selectionUpAction Adjust the current selection by moving the caret down one row upAction Move the caret up one position writableAction Set the editor to writable mode; results in a call to setEditable(true) on the JTextComponent 24.1.3.3 Using Actions Let’s look at a simple example that shows how these actions can be used. In this program, we’ll create a JTextArea and add all the available actions to a menu (the list is pretty long, so we split it into two submenus). As we discussed in the chapter on menus, we can add these Action objects directly to the menu. The default action names appear as menu selections. Since JTextArea gets its actions from the DefaultEditorKit, you’ll see each of the actions listed in Table 24.3 when you run this program. By blindly adding all of the actions, we avoid interacting with the editor kit directly in this program. At the end of this section, we’ll look at a much more useful example that uses DefaultEditorKit directly. // TextActionExample.java // import javax.swing.*; import javax.swing.text.*; // Simple TextAction examplepublic class TextActionExample { public static void main(String[] args) { - 794
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

Leave a Reply