[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: Swing fixes
Kaffe CVS
cvs-commits at kaffe.org
Mon Apr 18 17:04:00 PDT 2005
PatchSet 5703
Date: 2005/04/18 23:57:50
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Resynced with GNU Classpath: Swing fixes
2005-04-18 Dalibor Topic <robilad at kaffe.org>
Resynced with GNU Classpath.
2005-04-08 Roman Kennke <roman at kennke.org>
* javax/swing/text/JTextComponent.java
(JTextComponent): Added repaintListener which issues repaint
requests when the underlying document changes.
(setDocument): Adds repaintListener to document when the
document is changed.
* javax/swing/text/DefaultEditorKit.java:
Removed repaint calls on JTextComponent. This is now handled
through a DocumentListener in JTextComponent that repaints
the component when needed.
Members:
ChangeLog:1.3870->1.3871
libraries/javalib/javax/swing/text/DefaultEditorKit.java:1.9->1.10
libraries/javalib/javax/swing/text/JTextComponent.java:1.12->1.13
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3870 kaffe/ChangeLog:1.3871
--- kaffe/ChangeLog:1.3870 Mon Apr 18 21:19:28 2005
+++ kaffe/ChangeLog Mon Apr 18 23:57:50 2005
@@ -2,6 +2,22 @@
Resynced with GNU Classpath.
+ 2005-04-08 Roman Kennke <roman at kennke.org>
+
+ * javax/swing/text/JTextComponent.java
+ (JTextComponent): Added repaintListener which issues repaint
+ requests when the underlying document changes.
+ (setDocument): Adds repaintListener to document when the
+ document is changed.
+ * javax/swing/text/DefaultEditorKit.java:
+ Removed repaint calls on JTextComponent. This is now handled
+ through a DocumentListener in JTextComponent that repaints
+ the component when needed.
+
+2005-04-18 Dalibor Topic <robilad at kaffe.org>
+
+ Resynced with GNU Classpath.
+
2005-04-07 Roman Kennke <roman at kennke.org>
* javax/swing/UIDefaults.java:
Index: kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java
diff -u kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java:1.9 kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java:1.10
--- kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java:1.9 Sat Jan 22 19:10:56 2005
+++ kaffe/libraries/javalib/javax/swing/text/DefaultEditorKit.java Mon Apr 18 23:57:52 2005
@@ -110,7 +110,6 @@
t.getDocument().insertString(t.getCaret().getDot(), event.getActionCommand(), null);
t.getCaret().setDot(Math.min(t.getCaret().getDot() + 1,
t.getDocument().getEndPosition().getOffset()));
- t.repaint();
}
catch (BadLocationException be)
{
@@ -251,7 +250,6 @@
if (pos < t.getDocument().getEndPosition().getOffset())
{
t.getDocument().remove(t.getCaret().getDot(), 1);
- t.repaint();
}
}
catch (BadLocationException e)
@@ -275,7 +273,6 @@
{
t.getDocument().remove(pos - 1, 1);
t.getCaret().setDot(pos - 1);
- t.repaint();
}
}
catch (BadLocationException e)
Index: kaffe/libraries/javalib/javax/swing/text/JTextComponent.java
diff -u kaffe/libraries/javalib/javax/swing/text/JTextComponent.java:1.12 kaffe/libraries/javalib/javax/swing/text/JTextComponent.java:1.13
--- kaffe/libraries/javalib/javax/swing/text/JTextComponent.java:1.12 Mon Apr 18 18:25:49 2005
+++ kaffe/libraries/javalib/javax/swing/text/JTextComponent.java Mon Apr 18 23:57:52 2005
@@ -894,11 +894,30 @@
private Insets margin;
private boolean dragEnabled;
+ /** Issues repaint request on document changes. */
+ private DocumentListener repaintListener;
+
/**
* Creates a new <code>JTextComponent</code> instance.
*/
public JTextComponent()
{
+ repaintListener = new DocumentListener()
+ {
+ public void changedUpdate(DocumentEvent ev)
+ {
+ repaint();
+ }
+ public void insertUpdate(DocumentEvent ev)
+ {
+ repaint();
+ }
+ public void removeUpdate(DocumentEvent ev)
+ {
+ repaint();
+ }
+ };
+
Keymap defkeymap = getKeymap(DEFAULT_KEYMAP);
boolean creatingKeymap = false;
if (defkeymap == null)
@@ -932,6 +951,13 @@
{
Document oldDoc = doc;
doc = newDoc;
+
+ // setup document listener
+ if (oldDoc != null)
+ oldDoc.removeDocumentListener(repaintListener);
+ if (newDoc != null)
+ newDoc.addDocumentListener(repaintListener);
+
firePropertyChange("document", oldDoc, newDoc);
revalidate();
repaint();
More information about the kaffe
mailing list