StyleConstants: setItalic(MutableAttributeSet a, boolean b) : StyleConstants « javax.swing.text « Java by API






StyleConstants: setItalic(MutableAttributeSet a, boolean b)

  


import java.awt.Color;

import javax.swing.JTextPane;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;

public class Main {
  public static void main(String[] argv) throws Exception {
    JTextPane textPane = new JTextPane();
    StyledDocument doc = textPane.getStyledDocument();

    // Makes text italicized
    Style style = textPane.addStyle("Italic", null);
    StyleConstants.setItalic(style, true);
  }
}

   
    
  








Related examples in the same category

1.StyleConstants.Bold
2.StyleConstants.Foreground
3.StyleConstants.Italic
4.StyleConstants.LineSpacing
5.StyleConstants: setAlignment(MutableAttributeSet a, int align)
6.StyleConstants: setBold(MutableAttributeSet a, boolean b)
7.StyleConstants: setComponent(MutableAttributeSet a, Component c)
8.StyleConstants: setFirstLineIndent(MutableAttributeSet a, float i)
9.StyleConstants: setFontFamily(MutableAttributeSet a, String fam)
10.StyleConstants: setForeground(MutableAttributeSet a, Color fg)
11.StyleConstants: setFontSize(MutableAttributeSet a, int s)
12.StyleConstants: setIcon(MutableAttributeSet a, Icon c)
13.StyleConstants: setLeftIndent(MutableAttributeSet a, float i)
14.StyleConstants: setRightIndent(MutableAttributeSet a, float i)
15.StyleConstants: setSpaceAbove(MutableAttributeSet a, float i)
16.StyleConstants: setSpaceBelow(MutableAttributeSet a, float i)
17.StyleConstants: setTabSet(MutableAttributeSet a, TabSet tabs)
18.StyleConstants: setUnderline(MutableAttributeSet a, boolean b)