<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjavax.swing.text%2FStyledDocument</id>
		<title>Java by API/javax.swing.text/StyledDocument - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjavax.swing.text%2FStyledDocument"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/javax.swing.text/StyledDocument&amp;action=history"/>
		<updated>2026-04-25T02:40:21Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_by_API/javax.swing.text/StyledDocument&amp;diff=237&amp;oldid=prev</id>
		<title> в 17:43, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/javax.swing.text/StyledDocument&amp;diff=237&amp;oldid=prev"/>
				<updated>2010-05-31T17:43:48Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 17:43, 31 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java_by_API/javax.swing.text/StyledDocument&amp;diff=238&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java_by_API/javax.swing.text/StyledDocument&amp;diff=238&amp;oldid=prev"/>
				<updated>2010-05-31T14:12:29Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== StyledDocument: addStyle(String nm, Style parent) ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import javax.swing.JTextPane;&lt;br /&gt;
import javax.swing.text.Style;&lt;br /&gt;
import javax.swing.text.StyleConstants;&lt;br /&gt;
import javax.swing.text.StyledDocument;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] argv) throws Exception{&lt;br /&gt;
    JTextPane textPane = new JTextPane();&lt;br /&gt;
    StyledDocument doc = (StyledDocument) textPane.getDocument();&lt;br /&gt;
    // Create a style object and then set the style attributes&lt;br /&gt;
    Style style = doc.addStyle(&amp;quot;StyleName&amp;quot;, null);&lt;br /&gt;
    StyleConstants.setForeground(style, Color.white);&lt;br /&gt;
    // Append to document&lt;br /&gt;
    doc.insertString(doc.getLength(), &amp;quot;Some Text&amp;quot;, style);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== StyledDocument: insertString(int offset, String str, AttributeSet a) ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
import java.awt.Color;&lt;br /&gt;
import javax.swing.JTextPane;&lt;br /&gt;
import javax.swing.text.Style;&lt;br /&gt;
import javax.swing.text.StyleConstants;&lt;br /&gt;
import javax.swing.text.StyledDocument;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] argv) throws Exception{&lt;br /&gt;
    JTextPane textPane = new JTextPane();&lt;br /&gt;
    StyledDocument doc = (StyledDocument) textPane.getDocument();&lt;br /&gt;
    // Create a style object and then set the style attributes&lt;br /&gt;
    Style style = doc.addStyle(&amp;quot;StyleName&amp;quot;, null);&lt;br /&gt;
    StyleConstants.setForeground(style, Color.white);&lt;br /&gt;
    // Append to document&lt;br /&gt;
    doc.insertString(doc.getLength(), &amp;quot;Some Text&amp;quot;, style);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== StyledDocument: setCharacterAttributes(int offset, int length, AttributeSet s, boolean replace) ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
import javax.swing.JTextPane;&lt;br /&gt;
import javax.swing.text.StyledDocument;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] argv) throws Exception {&lt;br /&gt;
    JTextPane textPane = new JTextPane();&lt;br /&gt;
    StyledDocument doc = textPane.getStyledDocument();&lt;br /&gt;
    // Set text in the range [5, 7) red&lt;br /&gt;
    doc.setCharacterAttributes(5, 2, textPane.getStyle(&amp;quot;Red&amp;quot;), true);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== StyledDocument: setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace) ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
import java.awt.BorderLayout;&lt;br /&gt;
import javax.swing.JFrame;&lt;br /&gt;
import javax.swing.JScrollPane;&lt;br /&gt;
import javax.swing.JTextPane;&lt;br /&gt;
import javax.swing.text.BadLocationException;&lt;br /&gt;
import javax.swing.text.DefaultStyledDocument;&lt;br /&gt;
import javax.swing.text.SimpleAttributeSet;&lt;br /&gt;
import javax.swing.text.StyleConstants;&lt;br /&gt;
import javax.swing.text.StyledDocument;&lt;br /&gt;
import javax.swing.text.TabSet;&lt;br /&gt;
import javax.swing.text.TabStop;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(final String args[]) {&lt;br /&gt;
    JFrame frame = new JFrame(&amp;quot;Tab Attributes&amp;quot;);&lt;br /&gt;
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);&lt;br /&gt;
    StyledDocument document = new DefaultStyledDocument();&lt;br /&gt;
    int positions[] = { TabStop.ALIGN_BAR, TabStop.ALIGN_CENTER, TabStop.ALIGN_DECIMAL,&lt;br /&gt;
        TabStop.ALIGN_LEFT, TabStop.ALIGN_RIGHT };&lt;br /&gt;
    String strings[] = { &amp;quot;\tTabStop.ALIGN_BAR\n&amp;quot;, &amp;quot;\tTabStop.ALIGN_CENTER\n&amp;quot;,&lt;br /&gt;
        &amp;quot;\tTabStop.ALIGN_DECIMAL\n&amp;quot;, &amp;quot;\tTabStop.ALIGN_LEFT\n&amp;quot;, &amp;quot;\tTabStop.ALIGN_RIGHT\n&amp;quot; };&lt;br /&gt;
    SimpleAttributeSet attributes = new SimpleAttributeSet();&lt;br /&gt;
    for (int i = 0, n = positions.length; i &amp;lt; n; i++) {&lt;br /&gt;
      TabStop tabstop = new TabStop(150, positions[i], TabStop.LEAD_DOTS);&lt;br /&gt;
      try {&lt;br /&gt;
        int position = document.getLength();&lt;br /&gt;
        document.insertString(position, strings[i], null);&lt;br /&gt;
        TabSet tabset = new TabSet(new TabStop[] { tabstop });&lt;br /&gt;
        StyleConstants.setTabSet(attributes, tabset);&lt;br /&gt;
        document.setParagraphAttributes(position, 1, attributes, false);&lt;br /&gt;
      } catch (BadLocationException badLocationException) {&lt;br /&gt;
        System.err.println(&amp;quot;Bad Location&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
    JTextPane textPane = new JTextPane(document);&lt;br /&gt;
    textPane.setEditable(false);&lt;br /&gt;
    JScrollPane scrollPane = new JScrollPane(textPane);&lt;br /&gt;
    frame.add(scrollPane, BorderLayout.CENTER);&lt;br /&gt;
    frame.setSize(300, 150);&lt;br /&gt;
    frame.setVisible(true);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
           &lt;br /&gt;
         &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>