summaryrefslogtreecommitdiff
path: root/javax/swing/text
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2005-09-13 23:44:48 +0000
committerRoman Kennke <roman@kennke.org>2005-09-13 23:44:48 +0000
commit86cbbbcafb077a1ec88266d67799846cd3391968 (patch)
tree71a53b7b6c8ea2c29aaeef32b7b206a560d4590a /javax/swing/text
parent71d1cdc7ea1ad8733013dba722d93f94cef130d7 (diff)
downloadclasspath-86cbbbcafb077a1ec88266d67799846cd3391968.tar.gz
2005-09-14 Roman Kennke <kennke@aicas.com>
* javax/swing/text/AbstractDocument.java Bumped up serialVersionUIDs to JDK 1.5 compatibility. (getContent): Made method final. (AbstractElement.dumpElement): Removed superfluous private method. (AbstractElement.dump): Made diagnostic output more speaking. * javax/swing/text/BoxView.java (paintChild): Don't allocate the child region here. (paint): Allocate the child region here instead. * javax/swing/text/ComponentView.java: Added API doc comments. * javax/swing/text/CompositeView.java (getNextVisualPositionFrom): Declared to throw BadLocationException. (getNextNorthSouthVisualPositionFrom): Likewise. (getNextEastWestVisualPositionFrom): Likewise. * javax/swing/text/DefaultCaret.java Bumped up serialVersionUIDs to JDK 1.5 compatibility. * javax/swing/text/DefaultEditorKit.java Slight reformatting. * javax/swing/text/DefaultFormatter.java Bumped up serialVersionUIDs to JDK 1.5 compatibility. * javax/swing/text/DefaultStyledEditorKit.java (ElementBuffer.insertUpdate): Removed unneeded statement. (ElementBuffer.insertStartTag): Attach a resolve parent to new paragraph elements. (createDefaultRoot): Attach a resolve parent to new paragraph elements. * javax/swing/text/InternationalFormatter.java Bumped up serialVersionUIDs to JDK 1.5 compatibility. * javax/swing/text/JTextComponent.java Slight reformatting. (paramString): Added TODO comment. * javax/swing/text/SimpleAttributeSet.java Bumped up serialVersionUIDs to JDK 1.5 compatibility. (equals): Don't require object to be SimpleAttributeSet. Allows comparing to all kinds of AttributeSets. (isEqual): Likewise. * javax/swing/text/StringContent.java Bumped up serialVersionUIDs to JDK 1.5 compatibility. * javax/swing/text/StyleConstants.java (getBackground): Return white as default background instead of black. * javax/swing/text/StyleConstext.java Bumped up serialVersionUIDs to JDK 1.5 compatibility. (SmallAttributeSet.equals): Don't require object to be SmallAttributeSet. Allows comparing to all kinds of AttributeSets. * javax/swing/text/StyledEditorKit.java Fixed some comments. * javax/swing/text/TabSet.java Bumped up serialVersionUIDs to JDK 1.5 compatibility. * javax/swing/text/TabStop.java Bumped up serialVersionUIDs to JDK 1.5 compatibility. * javax/swing/text/View.java Removed unneeded import.
Diffstat (limited to 'javax/swing/text')
-rw-r--r--javax/swing/text/AbstractDocument.java129
-rw-r--r--javax/swing/text/BoxView.java7
-rw-r--r--javax/swing/text/ComponentView.java98
-rw-r--r--javax/swing/text/CompositeView.java3
-rw-r--r--javax/swing/text/DefaultCaret.java6
-rw-r--r--javax/swing/text/DefaultEditorKit.java21
-rw-r--r--javax/swing/text/DefaultFormatter.java10
-rw-r--r--javax/swing/text/DefaultStyledDocument.java6
-rw-r--r--javax/swing/text/InternationalFormatter.java5
-rw-r--r--javax/swing/text/JTextComponent.java10
-rw-r--r--javax/swing/text/SimpleAttributeSet.java15
-rw-r--r--javax/swing/text/StringContent.java3
-rw-r--r--javax/swing/text/StyleConstants.java2
-rw-r--r--javax/swing/text/StyleContext.java8
-rw-r--r--javax/swing/text/StyledEditorKit.java24
-rw-r--r--javax/swing/text/TabSet.java3
-rw-r--r--javax/swing/text/TabStop.java3
-rw-r--r--javax/swing/text/View.java1
18 files changed, 207 insertions, 147 deletions
diff --git a/javax/swing/text/AbstractDocument.java b/javax/swing/text/AbstractDocument.java
index 3c9a4d497..660cd2b09 100644
--- a/javax/swing/text/AbstractDocument.java
+++ b/javax/swing/text/AbstractDocument.java
@@ -65,11 +65,10 @@ import javax.swing.undo.UndoableEdit;
* @author original author unknown
* @author Roman Kennke (roman@kennke.org)
*/
-public abstract class AbstractDocument
- implements Document, Serializable
+public abstract class AbstractDocument implements Document, Serializable
{
- /** The serial version UID for this class as of JDK1.4. */
- private static final long serialVersionUID = -116069779446114664L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 6842927725919637215L;
/**
* Standard error message to indicate a bad location.
@@ -332,7 +331,7 @@ public abstract class AbstractDocument
* @see GapContent
* @see StringContent
*/
- protected Content getContent()
+ protected final Content getContent()
{
return content;
}
@@ -970,8 +969,8 @@ public abstract class AbstractDocument
public abstract class AbstractElement
implements Element, MutableAttributeSet, TreeNode, Serializable
{
- /** The serial version UID for AbstractElement. */
- private static final long serialVersionUID = 1265312733007397733L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 1712240033321461704L;
/** The number of characters that this Element spans. */
int count;
@@ -1355,49 +1354,6 @@ public abstract class AbstractDocument
public abstract int getStartOffset();
/**
- * Prints diagnostic information to the specified stream.
- *
- * @param stream the stream to dump to
- * @param indent the indentation level
- * @param element the element to be dumped
- */
- private void dumpElement(PrintStream stream, String indent,
- Element element)
- {
- // FIXME: Should the method be removed?
- System.out.println(indent + "<" + element.getName() +">");
-
- if (element.isLeaf())
- {
- int start = element.getStartOffset();
- int end = element.getEndOffset();
- String text = "";
- try
- {
- text = getContent().getString(start, end - start);
- }
- catch (BadLocationException e)
- {
- AssertionError error =
- new AssertionError("BadLocationException should not be "
- + "thrown here. start = " + start
- + ", end = " + end);
- error.initCause(e);
- throw error;
- }
- System.out.println(indent + " ["
- + start + ","
- + end + "]["
- + text + "]");
- }
- else
- {
- for (int i = 0; i < element.getElementCount(); ++i)
- dumpElement(stream, indent + " ", element.getElement(i));
- }
- }
-
- /**
* Prints diagnostic output to the specified stream.
*
* @param stream the stream to write to
@@ -1405,10 +1361,65 @@ public abstract class AbstractDocument
*/
public void dump(PrintStream stream, int indent)
{
- String indentStr = "";
+ StringBuffer b = new StringBuffer();
for (int i = 0; i < indent; ++i)
- indentStr += " ";
- dumpElement(stream, indentStr, this);
+ b.append(' ');
+ b.append('<');
+ b.append(getName());
+ // Dump attributes if there are any.
+ if (getAttributeCount() > 0)
+ {
+ b.append('\n');
+ Enumeration attNames = getAttributeNames();
+ while (attNames.hasMoreElements())
+ {
+ for (int i = 0; i < indent + 2; ++i)
+ b.append(' ');
+ Object attName = attNames.nextElement();
+ b.append(attName);
+ b.append('=');
+ Object attribute = getAttribute(attName);
+ b.append(attribute);
+ b.append('\n');
+ }
+ }
+ b.append(">\n");
+
+ // Dump element content for leaf elements.
+ if (isLeaf())
+ {
+ for (int i = 0; i < indent + 2; ++i)
+ b.append(' ');
+ int start = getStartOffset();
+ int end = getEndOffset();
+ b.append('[');
+ b.append(start);
+ b.append(',');
+ b.append(end);
+ b.append("][");
+ try
+ {
+ b.append(getDocument().getText(start, end - start));
+ }
+ catch (BadLocationException ex)
+ {
+ AssertionError err = new AssertionError("BadLocationException "
+ + "must not be thrown "
+ + "here.");
+ err.initCause(ex);
+ }
+ b.append("]\n");
+ }
+ stream.print(b.toString());
+
+ // Dump child elements if any.
+ int count = getElementCount();
+ for (int i = 0; i < count; ++i)
+ {
+ Element el = getElement(i);
+ if (el instanceof AbstractElement)
+ ((AbstractElement) el).dump(stream, indent + 2);
+ }
}
}
@@ -1418,8 +1429,8 @@ public abstract class AbstractDocument
*/
public class BranchElement extends AbstractElement
{
- /** The serial version UID for BranchElement. */
- private static final long serialVersionUID = -8595176318868717313L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -6037216547466333183L;
/** The child elements of this BranchElement. */
private Element[] children = new Element[0];
@@ -1642,8 +1653,8 @@ public abstract class AbstractDocument
public class DefaultDocumentEvent extends CompoundEdit
implements DocumentEvent
{
- /** The serial version UID of DefaultDocumentEvent. */
- private static final long serialVersionUID = -7406103236022413522L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 5230037221564563284L;
/** The starting offset of the change. */
private int offset;
@@ -1843,8 +1854,8 @@ public abstract class AbstractDocument
*/
public class LeafElement extends AbstractElement
{
- /** The serial version UID of LeafElement. */
- private static final long serialVersionUID = 5115368706941283802L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -8906306331347768017L;
/** Manages the start offset of this element. */
Position startPos;
diff --git a/javax/swing/text/BoxView.java b/javax/swing/text/BoxView.java
index 0f8ba1ce1..bc08626bd 100644
--- a/javax/swing/text/BoxView.java
+++ b/javax/swing/text/BoxView.java
@@ -221,7 +221,6 @@ public class BoxView
protected void paintChild(Graphics g, Rectangle alloc, int index)
{
View child = getView(index);
- childAllocation(index, alloc);
child.paint(g, alloc);
}
@@ -306,12 +305,8 @@ public class BoxView
int count = getViewCount();
for (int i = 0; i < count; ++i)
{
- // TODO: Figure out if the parameter to paintChild is meant to
- // be the child allocation or the allocation of this BoxView.
- // I assume the second option here.
- // We pass this method a copy of the inside rectangle here because
- // it modifies the actual values.
copy.setBounds(inside);
+ childAllocation(i, copy);
paintChild(g, copy, i);
}
}
diff --git a/javax/swing/text/ComponentView.java b/javax/swing/text/ComponentView.java
index f6feda215..0ebeaac1f 100644
--- a/javax/swing/text/ComponentView.java
+++ b/javax/swing/text/ComponentView.java
@@ -1,5 +1,5 @@
/* ComponentView.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,32 +41,82 @@ import java.awt.Component;
import java.awt.Graphics;
import java.awt.Shape;
+/**
+ * A {@link View} implementation that is able to render arbitrary
+ * {@link Components}. This uses the attribute
+ * {@link StyleConstants#ComponentAttribute} to determine the
+ * <code>Component</code> that should be rendered. This <code>Component</code>
+ * becomes a direct child of the <code>JTextComponent</code> that contains
+ * this <code>ComponentView</code>, so this view must not be shared between
+ * multiple <code>JTextComponent</code>s.
+ *
+ * @author original author unknown
+ * @author Roman Kennke (roman@kennke.org)
+ */
public class ComponentView extends View
{
- public ComponentView(Element elem)
- {
- super(elem);
- }
-
- protected Component createComponent()
- {
- return null;
- }
-
- public float getAlignment(int axis)
- {
- return 0;
- }
+ /**
+ * Creates a new instance of <code>ComponentView</code> for the specified
+ * <code>Element</code>.
+ *
+ * @param elem the element that this <code>View</code> is rendering
+ */
+ public ComponentView(Element elem)
+ {
+ super(elem);
+ }
- public final Component getComponent()
- {
- return null;
- }
-
- public float getMaximumSpan(int axis)
- {
- return 0;
- }
+ /**
+ * Creates the <code>Component</code> that this <code>View</code> is
+ * rendering. The <code>Component</code> is determined using
+ * the {@link StyleConstants#ComponentAttribute} of the associated
+ * <code>Element</code>.
+ *
+ * @return the component that is rendered
+ */
+ protected Component createComponent()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the alignment of this <code>View</code> along the specified axis.
+ *
+ * @param axis either {@link View#X_AXIS} or {@link View#Y_AXIS}
+ *
+ * @return the alignment of this <code>View</code> along the specified axis
+ */
+ public float getAlignment(int axis)
+ {
+ return 0;
+ }
+
+ /**
+ * Returns the <code>Component</code> that is rendered by this
+ * <code>ComponentView</code>.
+ *
+ * @return the <code>Component</code> that is rendered by this
+ * <code>ComponentView</code>
+ */
+ public final Component getComponent()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the maximum span of this <code>View</code> along the specified
+ * axis.
+ *
+ * This will return {@link Component#getMaximumSize()} for the specified
+ * axis.
+ *
+ * @return the maximum span of this <code>View</code> along the specified
+ * axis
+ */
+ public float getMaximumSpan(int axis)
+ {
+ return 0;
+ }
public float getMinimumSpan(int axis)
{
diff --git a/javax/swing/text/CompositeView.java b/javax/swing/text/CompositeView.java
index 6776c9572..b3dd6123e 100644
--- a/javax/swing/text/CompositeView.java
+++ b/javax/swing/text/CompositeView.java
@@ -314,6 +314,7 @@ public abstract class CompositeView
*/
public int getNextVisualPositionFrom(int pos, Position.Bias b, Shape a,
int direction, Position.Bias[] biasRet)
+ throws BadLocationException
{
int retVal = -1;
switch (direction)
@@ -594,6 +595,7 @@ public abstract class CompositeView
protected int getNextNorthSouthVisualPositionFrom(int pos, Position.Bias b,
Shape a, int direction,
Position.Bias[] biasRet)
+ throws BadLocationException
{
// FIXME: Implement this correctly.
return pos;
@@ -627,6 +629,7 @@ public abstract class CompositeView
protected int getNextEastWestVisualPositionFrom(int pos, Position.Bias b,
Shape a, int direction,
Position.Bias[] biasRet)
+ throws BadLocationException
{
// FIXME: Implement this correctly.
return pos;
diff --git a/javax/swing/text/DefaultCaret.java b/javax/swing/text/DefaultCaret.java
index 33c3ae3bf..c247afcff 100644
--- a/javax/swing/text/DefaultCaret.java
+++ b/javax/swing/text/DefaultCaret.java
@@ -60,10 +60,8 @@ import javax.swing.event.EventListenerList;
public class DefaultCaret extends Rectangle
implements Caret, FocusListener, MouseListener, MouseMotionListener
{
- /**
- * The serial version UID for DefaultCaret.
- */
- private static final long serialVersionUID = 228155774675466193L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 4325555698756477346L;
/**
* The <code>ChangeEvent</code> that is fired by {@link #fireStateChanged()}.
diff --git a/javax/swing/text/DefaultEditorKit.java b/javax/swing/text/DefaultEditorKit.java
index a14f3ff4f..2f901947f 100644
--- a/javax/swing/text/DefaultEditorKit.java
+++ b/javax/swing/text/DefaultEditorKit.java
@@ -66,8 +66,7 @@ public class DefaultEditorKit extends EditorKit
*
* @see Toolkit#beep()
*/
- public static class BeepAction
- extends TextAction
+ public static class BeepAction extends TextAction
{
/**
* Creates a new <code>BeepAction</code>.
@@ -95,8 +94,7 @@ public class DefaultEditorKit extends EditorKit
* @see CutAction
* @see PasteAction
*/
- public static class CopyAction
- extends TextAction
+ public static class CopyAction extends TextAction
{
/**
@@ -128,8 +126,7 @@ public class DefaultEditorKit extends EditorKit
* @see CopyAction
* @see PasteAction
*/
- public static class CutAction
- extends TextAction
+ public static class CutAction extends TextAction
{
/**
@@ -159,8 +156,7 @@ public class DefaultEditorKit extends EditorKit
* @see CopyAction
* @see CutAction
*/
- public static class PasteAction
- extends TextAction
+ public static class PasteAction extends TextAction
{
/**
@@ -243,8 +239,7 @@ public class DefaultEditorKit extends EditorKit
* of the text component. This is typically triggered by hitting
* ENTER on the keyboard.
*/
- public static class InsertBreakAction
- extends TextAction
+ public static class InsertBreakAction extends TextAction
{
/**
@@ -273,8 +268,7 @@ public class DefaultEditorKit extends EditorKit
*/
// FIXME: Figure out what this Action is supposed to do. Obviously text
// that is entered by the user is inserted through DefaultKeyTypedAction.
- public static class InsertContentAction
- extends TextAction
+ public static class InsertContentAction extends TextAction
{
/**
@@ -298,8 +292,7 @@ public class DefaultEditorKit extends EditorKit
/**
* Inserts a TAB character into the text editor.
*/
- public static class InsertTabAction
- extends TextAction
+ public static class InsertTabAction extends TextAction
{
/**
diff --git a/javax/swing/text/DefaultFormatter.java b/javax/swing/text/DefaultFormatter.java
index c97d90703..16d40c24b 100644
--- a/javax/swing/text/DefaultFormatter.java
+++ b/javax/swing/text/DefaultFormatter.java
@@ -57,8 +57,7 @@ import javax.swing.JFormattedTextField;
*
* @author Roman Kennke (roman@kennke.org)
*/
-public class DefaultFormatter
- extends JFormattedTextField.AbstractFormatter
+public class DefaultFormatter extends JFormattedTextField.AbstractFormatter
implements Cloneable, Serializable
{
@@ -156,9 +155,6 @@ public class DefaultFormatter
* Checks if the value in the input field is valid. If the
* property allowsInvalid is set to <code>false</code>, then
* the string in the input field is not allowed to be entered.
- *
- * @param doc the document of the input field
- * @param value the current (old) value of the input field
*/
private void checkValidInput()
{
@@ -186,8 +182,8 @@ public class DefaultFormatter
}
}
- /** The serialVersoinUID. */
- private static final long serialVersionUID = -7369196326612908900L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -355018354457785329L;
/**
* Indicates if the value should be committed after every
diff --git a/javax/swing/text/DefaultStyledDocument.java b/javax/swing/text/DefaultStyledDocument.java
index a6368a89d..778bc8c45 100644
--- a/javax/swing/text/DefaultStyledDocument.java
+++ b/javax/swing/text/DefaultStyledDocument.java
@@ -504,7 +504,6 @@ public class DefaultStyledDocument extends AbstractDocument
insertContentTag(data[i]);
break;
}
- BranchElement root = (BranchElement) getDefaultRootElement();
}
}
@@ -522,6 +521,7 @@ public class DefaultStyledDocument extends AbstractDocument
BranchElement newParagraph =
(BranchElement) createBranchElement(root, tag.getAttributes());
+ newParagraph.setResolveParent(getStyle(StyleContext.DEFAULT_STYLE));
// Add new paragraph into document structure.
Element[] added = new Element[]{newParagraph};
@@ -796,7 +796,9 @@ public class DefaultStyledDocument extends AbstractDocument
// Use createBranchElement() and createLeafElement instead.
SectionElement section = new SectionElement();
- BranchElement paragraph = new BranchElement(section, null);
+ BranchElement paragraph =
+ (BranchElement) createBranchElement(section, null);
+ paragraph.setResolveParent(getStyle(StyleContext.DEFAULT_STYLE));
tmp = new Element[1];
tmp[0] = paragraph;
section.replace(0, 0, tmp);
diff --git a/javax/swing/text/InternationalFormatter.java b/javax/swing/text/InternationalFormatter.java
index cedaf59fe..86300a70d 100644
--- a/javax/swing/text/InternationalFormatter.java
+++ b/javax/swing/text/InternationalFormatter.java
@@ -57,9 +57,8 @@ import javax.swing.JFormattedTextField;
public class InternationalFormatter
extends DefaultFormatter
{
-
- /** The serialVersoinUID. */
- private static final long serialVersionUID = 6941977820906408656L;
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 2436068675711756856L;
/** The format that handles value to string conversion. */
Format format;
diff --git a/javax/swing/text/JTextComponent.java b/javax/swing/text/JTextComponent.java
index b3fad7912..63dbf2a4b 100644
--- a/javax/swing/text/JTextComponent.java
+++ b/javax/swing/text/JTextComponent.java
@@ -303,9 +303,7 @@ public abstract class JTextComponent extends JComponent
/**
* The timer that lets the caret blink.
*/
- private class CaretBlinkTimer
- extends Timer
- implements ActionListener
+ private class CaretBlinkTimer extends Timer implements ActionListener
{
/**
* Creates a new CaretBlinkTimer object with a default delay of 1 second.
@@ -604,8 +602,7 @@ public abstract class JTextComponent extends JComponent
}
}
- class DefaultTransferHandler
- extends TransferHandler
+ class DefaultTransferHandler extends TransferHandler
{
public boolean canImport(JComponent component, DataFlavor[] flavors)
{
@@ -1105,7 +1102,8 @@ public abstract class JTextComponent extends JComponent
*/
protected String paramString()
{
- return "JTextComponent";
+ // TODO: Do something useful here.
+ return super.paramString();
}
/**
diff --git a/javax/swing/text/SimpleAttributeSet.java b/javax/swing/text/SimpleAttributeSet.java
index 3ef5db61d..61cf5e97c 100644
--- a/javax/swing/text/SimpleAttributeSet.java
+++ b/javax/swing/text/SimpleAttributeSet.java
@@ -45,6 +45,9 @@ import java.util.Hashtable;
public class SimpleAttributeSet
implements MutableAttributeSet, Serializable, Cloneable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 8267656273837665219L;
+
public static final AttributeSet EMPTY = new SimpleAttributeSet();
Hashtable tab;
@@ -89,7 +92,7 @@ public class SimpleAttributeSet
return tab.containsKey(name)
&& tab.get(name).equals(value);
}
-
+
public boolean containsAttributes(AttributeSet attributes)
{
Enumeration e = attributes.getAttributeNames();
@@ -110,9 +113,9 @@ public class SimpleAttributeSet
public boolean equals(Object obj)
{
- return (obj != null)
- && (obj instanceof SimpleAttributeSet)
- && ((SimpleAttributeSet)obj).tab.equals(this.tab);
+ return
+ (obj instanceof AttributeSet)
+ && this.isEqual((AttributeSet) obj);
}
public Object getAttribute(Object name)
@@ -160,7 +163,9 @@ public class SimpleAttributeSet
public boolean isEqual(AttributeSet attr)
{
- return this.equals(attr);
+ return attr != null
+ && attr.containsAttributes(this)
+ && this.containsAttributes(attr);
}
public void removeAttribute(Object name)
diff --git a/javax/swing/text/StringContent.java b/javax/swing/text/StringContent.java
index bedf480d4..7db377a1c 100644
--- a/javax/swing/text/StringContent.java
+++ b/javax/swing/text/StringContent.java
@@ -56,6 +56,9 @@ import javax.swing.undo.UndoableEdit;
*/
public final class StringContent implements AbstractDocument.Content, Serializable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 4755994433709540381L;
+
// This is package-private to avoid an accessor method.
char[] content;
diff --git a/javax/swing/text/StyleConstants.java b/javax/swing/text/StyleConstants.java
index 3f973f226..7d8f9bb63 100644
--- a/javax/swing/text/StyleConstants.java
+++ b/javax/swing/text/StyleConstants.java
@@ -109,7 +109,7 @@ public class StyleConstants
if (a.isDefined(Background))
return (Color) a.getAttribute(Background);
else
- return Color.BLACK;
+ return Color.WHITE;
}
public static int getBidiLevel(AttributeSet a)
diff --git a/javax/swing/text/StyleContext.java b/javax/swing/text/StyleContext.java
index ae11622ff..eda13e744 100644
--- a/javax/swing/text/StyleContext.java
+++ b/javax/swing/text/StyleContext.java
@@ -57,9 +57,15 @@ import javax.swing.event.EventListenerList;
public class StyleContext
implements Serializable, AbstractDocument.AttributeContext
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 8042858831190784241L;
+
public class NamedStyle
implements Serializable, Style
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -6690628971806226374L;
+
protected ChangeEvent changeEvent;
protected EventListenerList listenerList;
@@ -288,7 +294,7 @@ public class StyleContext
public boolean equals(Object obj)
{
return
- (obj instanceof SmallAttributeSet)
+ (obj instanceof AttributeSet)
&& this.isEqual((AttributeSet)obj);
}
diff --git a/javax/swing/text/StyledEditorKit.java b/javax/swing/text/StyledEditorKit.java
index 89c4cf18e..e71f992b5 100644
--- a/javax/swing/text/StyledEditorKit.java
+++ b/javax/swing/text/StyledEditorKit.java
@@ -40,13 +40,9 @@ package javax.swing.text;
import java.awt.Color;
import java.awt.event.ActionEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.Serializable;
import javax.swing.Action;
import javax.swing.JEditorPane;
-import javax.swing.JTextPane;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
@@ -460,11 +456,11 @@ public class StyledEditorKit extends DefaultEditorKit
* <code>StyledEditorKit</code>, namely the following types of Elements:
*
* <ul>
- * <li>{@link AbstractDocument.ContentElementName}</li>
- * <li>{@link AbstractDocument.ParagraphElementName}</li>
- * <li>{@link AbstractDocument.SectionElementName}</li>
- * <li>{@link StyleContext.ComponentElementName}</li>
- * <li>{@link StyleContext.IconElementName}</li>
+ * <li>{@link AbstractDocument#ContentElementName}</li>
+ * <li>{@link AbstractDocument#ParagraphElementName}</li>
+ * <li>{@link AbstractDocument#SectionElementName}</li>
+ * <li>{@link StyleConstants#ComponentElementName}</li>
+ * <li>{@link StyleConstants#IconElementName}</li>
* </ul>
*/
static class StyledViewFactory
@@ -667,11 +663,11 @@ public class StyledEditorKit extends DefaultEditorKit
* namely the following types of <code>Element</code>s:
*
* <ul>
- * <li>{@link AbstractDocument.ContentElementName}</li>
- * <li>{@link AbstractDocument.ParagraphElementName}</li>
- * <li>{@link AbstractDocument.SectionElementName}</li>
- * <li>{@link StyleContext.ComponentElementName}</li>
- * <li>{@link StyleContext.IconElementName}</li>
+ * <li>{@link AbstractDocument#ContentElementName}</li>
+ * <li>{@link AbstractDocument#ParagraphElementName}</li>
+ * <li>{@link AbstractDocument#SectionElementName}</li>
+ * <li>{@link StyleConstants#ComponentElementName}</li>
+ * <li>{@link StyleConstants#IconElementName}</li>
* </ul>
*
* @return a {@link ViewFactory} that is able to create {@link View}s
diff --git a/javax/swing/text/TabSet.java b/javax/swing/text/TabSet.java
index 146f545aa..ecad9444e 100644
--- a/javax/swing/text/TabSet.java
+++ b/javax/swing/text/TabSet.java
@@ -41,6 +41,9 @@ import java.io.Serializable;
public class TabSet implements Serializable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = 2367703481999080593L;
+
TabStop[] tabs;
public TabSet(TabStop[] t)
diff --git a/javax/swing/text/TabStop.java b/javax/swing/text/TabStop.java
index 032da8bca..56f862fda 100644
--- a/javax/swing/text/TabStop.java
+++ b/javax/swing/text/TabStop.java
@@ -41,6 +41,9 @@ import java.io.Serializable;
public class TabStop implements Serializable
{
+ /** The serialization UID (compatible with JDK1.5). */
+ private static final long serialVersionUID = -5381995917363605058L;
+
public static final int ALIGN_LEFT = 0;
public static final int ALIGN_RIGHT = 1;
public static final int ALIGN_CENTER = 2;
diff --git a/javax/swing/text/View.java b/javax/swing/text/View.java
index 24efba9a1..9cea4ecb0 100644
--- a/javax/swing/text/View.java
+++ b/javax/swing/text/View.java
@@ -43,7 +43,6 @@ import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
-import javax.swing.JComponent;
import javax.swing.SwingConstants;
import javax.swing.event.DocumentEvent;