/[classpath]/classpath/javax/swing/text/JTextComponent.java
ViewVC logotype

Diff of /classpath/javax/swing/text/JTextComponent.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13.2.6 by gnu_andrew, Sun Apr 3 00:09:10 2005 UTC revision 1.13.2.7 by gnu_andrew, Mon Apr 18 01:37:41 2005 UTC
# Line 894  public abstract class JTextComponent ext Line 894  public abstract class JTextComponent ext
894    private Insets margin;    private Insets margin;
895    private boolean dragEnabled;    private boolean dragEnabled;
896    
897      /** Issues repaint request on document changes. */
898      private DocumentListener repaintListener;
899    
900    /**    /**
901     * Creates a new <code>JTextComponent</code> instance.     * Creates a new <code>JTextComponent</code> instance.
902     */     */
903    public JTextComponent()    public JTextComponent()
904    {    {
905        repaintListener = new DocumentListener()
906          {
907            public void changedUpdate(DocumentEvent ev)
908            {
909              repaint();
910            }
911            public void insertUpdate(DocumentEvent ev)
912            {
913              repaint();
914            }
915            public void removeUpdate(DocumentEvent ev)
916            {
917              repaint();
918            }
919          };
920    
921      Keymap defkeymap = getKeymap(DEFAULT_KEYMAP);      Keymap defkeymap = getKeymap(DEFAULT_KEYMAP);
922      boolean creatingKeymap = false;      boolean creatingKeymap = false;
923      if (defkeymap == null)      if (defkeymap == null)
# Line 932  public abstract class JTextComponent ext Line 951  public abstract class JTextComponent ext
951    {    {
952      Document oldDoc = doc;      Document oldDoc = doc;
953      doc = newDoc;      doc = newDoc;
954    
955        // setup document listener
956        if (oldDoc != null)
957          oldDoc.removeDocumentListener(repaintListener);
958        if (newDoc != null)
959          newDoc.addDocumentListener(repaintListener);
960    
961      firePropertyChange("document", oldDoc, newDoc);      firePropertyChange("document", oldDoc, newDoc);
962      revalidate();      revalidate();
963      repaint();      repaint();

Legend:
Removed from v.1.13.2.6  
changed lines
  Added in v.1.13.2.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26