tailieunhanh - Java Swing phần 9

Hashtable, để chúng ta có thể truy cập vào bất kỳ hành động chúng ta cần theo tên. Trong ví dụ này, chúng tôi sau đó lấy hành động "cắt" từ các bảng bằng cách sử dụng các liên tục:AbstractDocument), gây ra các cấu trúc mô hình được in . | Java Swing - O Reilly Hashtable so that we can access any action we need by name. In this example we then retrieve the cut action from the table using the constant 1 The keen observer will notice that the properties table indicated that there were 47 actions available. One action is not defined as a constant but is still available by the name dump-model. This action just calls dump on the document of the currently focused JTextComponent assuming it s an AbstractDocument causing the model structure to be printed to . Hashtable actionHash new Hashtable Action actions for int i 0 i i String name String actions i .getValue name actions i Action cut Action Table DefaultEditorKit Action Name Constants Constant Description backwardAction Move the caret back one position beepAction Create a beep beginAction Move the caret to the beginning of the document beginLineAction Move the caret to the beginning of the current line beginParagraphAction Move the caret to the beginning of the current paragraph beginWordAction Move the caret to the beginning of the current word copyAction Copy the selected region and place it on the system clipboard cutAction Cut the selected region and place it on the system clipboard defaultKeyTypedAction Display the pressed key default when there is no special keymap entry for a pressed key deleteNextCharAction Delete the character following the caret position deletePrevCharAction Delete the character before the caret position downAction Move the caret down one position endAction Move the caret to the end of the document endLineAction Move the caret to the end of the current line endParagraphAction Move the caret to the end of the current paragraph endWordAction Move the caret to the end of the current word forwardAction Move the caret forward one position insertBreakAction Insert a line or .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.