diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-18 00:59:33 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-18 00:59:33 +0000 |
commit | 15d27402f51cf831d82aa31271f5c01855b4f2cf (patch) | |
tree | 4c44aaa3ed1ee1b4f15732664c05cfc9214e1fa9 /libjava/classpath/javax/swing/JTextPane.java | |
parent | 820206ad46c6fc0131d5771ec1051267022e875d (diff) | |
download | ppe42-gcc-15d27402f51cf831d82aa31271f5c01855b4f2cf.tar.gz ppe42-gcc-15d27402f51cf831d82aa31271f5c01855b4f2cf.zip |
Imported GNU Classpath gcj-import-20051117.
* gnu/java/net/protocol/file/Connection.java: Removed, fully merged.
* sources.am: Regenerated.
* Makefile.in: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107153 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/javax/swing/JTextPane.java')
-rw-r--r-- | libjava/classpath/javax/swing/JTextPane.java | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/libjava/classpath/javax/swing/JTextPane.java b/libjava/classpath/javax/swing/JTextPane.java index 1f5b99e43c5..a2aebd4ca68 100644 --- a/libjava/classpath/javax/swing/JTextPane.java +++ b/libjava/classpath/javax/swing/JTextPane.java @@ -47,7 +47,9 @@ import javax.swing.text.Document; import javax.swing.text.EditorKit; import javax.swing.text.Element; import javax.swing.text.MutableAttributeSet; +import javax.swing.text.SimpleAttributeSet; import javax.swing.text.Style; +import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; import javax.swing.text.StyledEditorKit; @@ -192,9 +194,20 @@ public class JTextPane */ public void insertComponent(Component component) { - // TODO: One space must be inserted here with attributes set to indicate - // that the component must be displayed here. Have to figure out the - // attributes. + SimpleAttributeSet atts = new SimpleAttributeSet(); + atts.addAttribute(StyleConstants.ComponentAttribute, component); + atts.addAttribute(StyleConstants.NameAttribute, + StyleConstants.ComponentElementName); + try + { + getDocument().insertString(getCaret().getDot(), " ", atts); + } + catch (BadLocationException ex) + { + AssertionError err = new AssertionError("Unexpected bad location"); + err.initCause(ex); + throw err; + } } /** @@ -204,9 +217,20 @@ public class JTextPane */ public void insertIcon(Icon icon) { - // TODO: One space must be inserted here with attributes set to indicate - // that the icon must be displayed here. Have to figure out the - // attributes. + SimpleAttributeSet atts = new SimpleAttributeSet(); + atts.addAttribute(StyleConstants.IconAttribute, icon); + atts.addAttribute(StyleConstants.NameAttribute, + StyleConstants.IconElementName); + try + { + getDocument().insertString(getCaret().getDot(), " ", atts); + } + catch (BadLocationException ex) + { + AssertionError err = new AssertionError("Unexpected bad location"); + err.initCause(ex); + throw err; + } } /** |