事件与文字器件: JTextPane : 格式文本面板 « Swing « Java 教程

En
Java 教程
1. 语言基础
2. 数据类型
3. 操作符
4. 流程控制
5. 类定义
6. 开发相关
7. 反射
8. 正则表达式
9. 集合
10. 线
11. 文件
12. 泛型
13. 本土化
14. Swing
15. Swing事件
16. 二维图形
17. SWT
18. SWT 二维图形
19. 网络
20. 数据库
21. Hibernate
22. JPA
23. JSP
24. JSTL
25. Servlet
26. Web服务SOA
27. EJB3
28. Spring
29. PDF
30. 电子邮件
31. 基于J2ME
32. J2EE应用
33. XML
34. 设计模式
35. 日志
36. 安全
37. Apache工具
38. 蚂蚁编译
39. JUnit单元测试
Java
Java 教程 » Swing » 格式文本面板 
14. 38. 11. 事件与文字器件: JTextPane
import java.util.Arrays;
import java.util.Comparator;

import javax.swing.Action;
import javax.swing.JTextPane;
import javax.swing.text.JTextComponent;

public class ListActionsJTextPane {
  public static void main(String args[]) {
    JTextComponent component = new JTextPane();

    // Process action list
    Action actions[] = component.getActions();
    // Define comparator to sort actions
    Comparator<Action> comparator = new Comparator<Action>() {
      public int compare(Action a1, Action a2) {
        String firstName = (Stringa1.getValue(Action.NAME);
        String secondName = (Stringa2.getValue(Action.NAME);
        return firstName.compareTo(secondName);
      }
    };
    Arrays.sort(actions, comparator);

    int count = actions.length;
    System.out.println("Count: " + count);
    for (int i = 0; i < count; i++) {
      System.out.printf("%28s : %s\n",actions[i].getValue(Action.NAME),actions[i].getClass().getName());
    }
  }
}
Count: 71
                        beep : javax.swing.text.DefaultEditorKit$BeepAction
              caret-backward : javax.swing.text.DefaultEditorKit$NextVisualPositionAction
                 caret-begin : javax.swing.text.DefaultEditorKit$BeginAction
            caret-begin-line : javax.swing.text.DefaultEditorKit$BeginLineAction
       caret-begin-paragraph : javax.swing.text.DefaultEditorKit$BeginParagraphAction
            caret-begin-word : javax.swing.text.DefaultEditorKit$BeginWordAction
                  caret-down : javax.swing.text.DefaultEditorKit$NextVisualPositionAction
                   caret-end : javax.swing.text.DefaultEditorKit$EndAction
              caret-end-line : javax.swing.text.DefaultEditorKit$EndLineAction
         caret-end-paragraph : javax.swing.text.DefaultEditorKit$EndParagraphAction
              caret-end-word : javax.swing.text.DefaultEditorKit$EndWordAction
               caret-forward : javax.swing.text.DefaultEditorKit$NextVisualPositionAction
             caret-next-word : javax.swing.text.DefaultEditorKit$NextWordAction
         caret-previous-word : javax.swing.text.DefaultEditorKit$PreviousWordAction
                    caret-up : javax.swing.text.DefaultEditorKit$NextVisualPositionAction
              center-justify : javax.swing.text.StyledEditorKit$AlignmentAction
           copy-to-clipboard : javax.swing.text.DefaultEditorKit$CopyAction
            cut-to-clipboard : javax.swing.text.DefaultEditorKit$CutAction
               default-typed : javax.swing.text.DefaultEditorKit$DefaultKeyTypedAction
                 delete-next : javax.swing.text.DefaultEditorKit$DeleteNextCharAction
             delete-previous : javax.swing.text.DefaultEditorKit$DeletePrevCharAction
                  dump-model : javax.swing.text.DefaultEditorKit$DumpModelAction
                   font-bold : javax.swing.text.StyledEditorKit$BoldAction
      font-family-Monospaced : javax.swing.text.StyledEditorKit$FontFamilyAction
       font-family-SansSerif : javax.swing.text.StyledEditorKit$FontFamilyAction
           font-family-Serif : javax.swing.text.StyledEditorKit$FontFamilyAction
                 font-italic : javax.swing.text.StyledEditorKit$ItalicAction
                font-size-10 : javax.swing.text.StyledEditorKit$FontSizeAction
                font-size-12 : javax.swing.text.StyledEditorKit$FontSizeAction
                font-size-14 : javax.swing.text.StyledEditorKit$FontSizeAction
                font-size-16 : javax.swing.text.StyledEditorKit$FontSizeAction
                font-size-18 : javax.swing.text.StyledEditorKit$FontSizeAction
                font-size-24 : javax.swing.text.StyledEditorKit$FontSizeAction
                font-size-36 : javax.swing.text.StyledEditorKit$FontSizeAction
                font-size-48 : javax.swing.text.StyledEditorKit$FontSizeAction
                 font-size-8 : javax.swing.text.StyledEditorKit$FontSizeAction
              font-underline : javax.swing.text.StyledEditorKit$UnderlineAction
                insert-break : javax.swing.text.StyledEditorKit$StyledInsertBreakAction
              insert-content : javax.swing.text.DefaultEditorKit$InsertContentAction
                  insert-tab : javax.swing.text.DefaultEditorKit$InsertTabAction
                left-justify : javax.swing.text.StyledEditorKit$AlignmentAction
                   page-down : javax.swing.text.DefaultEditorKit$VerticalPageAction
                     page-up : javax.swing.text.DefaultEditorKit$VerticalPageAction
        paste-from-clipboard : javax.swing.text.DefaultEditorKit$PasteAction
               right-justify : javax.swing.text.StyledEditorKit$AlignmentAction
                  select-all : javax.swing.text.DefaultEditorKit$SelectAllAction
                 select-line : javax.swing.text.DefaultEditorKit$SelectLineAction
            select-paragraph : javax.swing.text.DefaultEditorKit$SelectParagraphAction
                 select-word : javax.swing.text.DefaultEditorKit$SelectWordAction
          selection-backward : javax.swing.text.DefaultEditorKit$NextVisualPositionAction
             selection-begin : javax.swing.text.DefaultEditorKit$BeginAction
        selection-begin-line : javax.swing.text.DefaultEditorKit$BeginLineAction
   selection-begin-paragraph : javax.swing.text.DefaultEditorKit$BeginParagraphAction
        selection-begin-word : javax.swing.text.DefaultEditorKit$BeginWordAction
              selection-down : javax.swing.text.DefaultEditorKit$NextVisualPositionAction
               selection-end : javax.swing.text.DefaultEditorKit$EndAction
          selection-end-line : javax.swing.text.DefaultEditorKit$EndLineAction
     selection-end-paragraph : javax.swing.text.DefaultEditorKit$EndParagraphAction
          selection-end-word : javax.swing.text.DefaultEditorKit$EndWordAction
           selection-forward : javax.swing.text.DefaultEditorKit$NextVisualPositionAction
         selection-next-word : javax.swing.text.DefaultEditorKit$NextWordAction
         selection-page-down : javax.swing.text.DefaultEditorKit$VerticalPageAction
         selection-page-left : javax.swing.text.DefaultEditorKit$PageAction
        selection-page-right : javax.swing.text.DefaultEditorKit$PageAction
           selection-page-up : javax.swing.text.DefaultEditorKit$VerticalPageAction
     selection-previous-word : javax.swing.text.DefaultEditorKit$PreviousWordAction
                selection-up : javax.swing.text.DefaultEditorKit$NextVisualPositionAction
               set-read-only : javax.swing.text.DefaultEditorKit$ReadOnlyAction
                set-writable : javax.swing.text.DefaultEditorKit$WritableAction
 toggle-componentOrientation : javax.swing.text.DefaultEditorKit$ToggleComponentOrientationAction
                    unselect : javax.swing.text.DefaultEditorKit$UnselectAction
14. 38. 格式文本面板
14. 38. 1. 区别JEditorPane和JTextPane
14. 38. 2. TabStop和TabSet类TabStop和TabSet类
14. 38. 3. Loading a JTextPane with Content: using StyleConstants to set Align, Font size, SpaceLoading a JTextPane with Content: using StyleConstants to set Align, Font size, Space
14. 38. 4. StyleConstants类StyleConstants类
14. 38. 5. 更改字体大小JTextPane
14. 38. 6. SimpleAttribute :粗体,斜体SimpleAttribute :粗体,斜体
14. 38. 7. SimpleAttribute :粗体,斜体,颜色SimpleAttribute :粗体,斜体,颜色
14. 38. 8. 字体家族
14. 38. 9. 添加图标JTextPane添加图标JTextPane
14. 38. 10. Uses a listener label to display caret and selection status For JTextPaneUses a listener label to display caret and selection status For JTextPane
14. 38. 11. 事件与文字器件: JTextPane
14. 38. 12. 编辑器JTextPane
14. 38. 13. Create a right-aligned tab stop at 200 pixels from the left margin
14. 38. 14. Create a center-aligned tab stop at 300 pixels from the left margin
14. 38. 15. Create a decimal-aligned tab stop at 400 pixels from the left margin
14. 38. 16. 创建一个标签
14. 38. 17. Setting the Font and Color of Text in a JTextPane Using Styles: Makes text red
14. 38. 18. Setting the Font and Color of Text in a JTextPane Using Styles: Inherits from Red; makes text red and underlined
14. 38. 19. Setting the Font and Color of Text in a JTextPane Using Styles: Makes text 24pts
14. 38. 20. Setting the Font and Color of Text in a JTextPane Using Styles: Makes text italicized
14. 38. 21. 自定义标签停止JTextPane组件
14. 38. 22. 插入图片到JTextPane组件
14. 38. 23. 插入组件到JTextPane组件
14. 38. 24. 插入样式文本在JTextPane组件
14. 38. 25. A style can have multiple attributes; this one makes text bold and italic
14. 38. 26. 重复格式
14. 38. 27. 斜体全段
14. 38. 28. 格式列表与JTextPane
14. 38. 29. 列出的样式属性
14. 38. 30. 更换风格
14. 38. 31. 设置风格;取代段落样式
14. 38. 32. 获得风格和复原,新的段落样式
14. 38. 33. Determining If a Style Attribute Applies to a Character or the Paragraph
14. 38. 34. Determine if the attribute is a color or a font-related attribute.
14. 38. 35. 共享样式与JTextPanes
14. 38. 36. 背景颜色
14. 38. 37. 前景颜色
14. 38. 38. 列举段落,JTextPane组件
14. 38. 39. 显示简单的HTML文件
14. 38. 40. JTextPane外观
14. 38. 41. 从视图分离数据
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.