JDK-4307478 : Resetting tabsize on PlainDocument doesn't update the display
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2000-01-26
  • Updated: 2000-12-09
  • Resolved: 2000-12-09
Related Reports
Duplicate :  
Description
Here is the code:

import java.awt.*;
import java.util.*;
import java.io.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.text.html.*;

public class Test {
    private JEditorPane pane;
    int size;

    public static void main(String[] args) {
        new Test();
    }

    Test() {
        JFrame frame = new JFrame("TEST");
        final JTextArea ta = new JTextArea();
        frame.getContentPane().add(new JScrollPane(ta));
        JButton button = new JButton("TWEAK");
        button.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    ta.getDocument().putProperty
                        (PlainDocument.tabSizeAttribute,
                         new Integer(size));
                    size = size % 8 + 4;
                }
            });
        frame.getContentPane().add(button, BorderLayout.SOUTH);
        frame.pack();
        frame.show();
    }
}

Comments
WORK AROUND Call updateUI after setting the size
11-06-2004