Example usage for javax.swing.text StyledEditorKit.UnderlineAction StyledEditorKit.UnderlineAction

List of usage examples for javax.swing.text StyledEditorKit.UnderlineAction StyledEditorKit.UnderlineAction

Introduction

In this page you can find the example usage for javax.swing.text StyledEditorKit.UnderlineAction StyledEditorKit.UnderlineAction.

Prototype

StyledEditorKit.UnderlineAction

Source Link

Usage

From source file:components.TextComponentDemo.java

protected JMenu createStyleMenu() {
    JMenu menu = new JMenu("Style");

    Action action = new StyledEditorKit.BoldAction();
    action.putValue(Action.NAME, "Bold");
    menu.add(action);/*from w  ww .  jav  a  2  s. co m*/

    action = new StyledEditorKit.ItalicAction();
    action.putValue(Action.NAME, "Italic");
    menu.add(action);

    action = new StyledEditorKit.UnderlineAction();
    action.putValue(Action.NAME, "Underline");
    menu.add(action);

    menu.addSeparator();

    menu.add(new StyledEditorKit.FontSizeAction("12", 12));
    menu.add(new StyledEditorKit.FontSizeAction("14", 14));
    menu.add(new StyledEditorKit.FontSizeAction("18", 18));

    menu.addSeparator();

    menu.add(new StyledEditorKit.FontFamilyAction("Serif", "Serif"));
    menu.add(new StyledEditorKit.FontFamilyAction("SansSerif", "SansSerif"));

    menu.addSeparator();

    menu.add(new StyledEditorKit.ForegroundAction("Red", Color.red));
    menu.add(new StyledEditorKit.ForegroundAction("Green", Color.green));
    menu.add(new StyledEditorKit.ForegroundAction("Blue", Color.blue));
    menu.add(new StyledEditorKit.ForegroundAction("Black", Color.black));

    return menu;
}