JTextPane: setLogicalStyle(Style s) : JTextPane « javax.swing « Java by API






JTextPane: setLogicalStyle(Style s)

  

import java.util.ArrayList;
import java.util.List;

import javax.swing.JTextPane;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.TabSet;
import javax.swing.text.TabStop;

public class Main {
  public static void main(String[] argv) {
      JTextPane textPane = new JTextPane();

    List list = new ArrayList();

    TabStop[] tstops = (TabStop[]) list.toArray(new TabStop[0]);
    TabSet tabs = new TabSet(tstops);

    Style style = textPane.getLogicalStyle();
    StyleConstants.setTabSet(style, tabs);
    textPane.setLogicalStyle(style);
  }
}

   
    
  








Related examples in the same category

1.JTextPane: getDocument()
2.JTextPane: getStyledDocument()
3.JTextPane: insertComponent(Component c)
4.JTextPane: insertIcon(Icon g)
5.JTextPane: replaceSelection(String content)
6.JTextPane: setCaretPosition(int position)
7.JTextPane.setCharacterAttributes(AttributeSet attr, boolean replace)
8.JTextPane: setFont(Font font)
9.JTextPane: setParagraphAttributes(AttributeSet attr, boolean replace)