javajs.swing.JTextPane Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmol Show documentation
Show all versions of jmol Show documentation
Jmol: an open-source Java viewer for chemical structures in 3D
package javajs.swing;
import javajs.util.SB;
/**
* A simple implementation of a Swing JTextPane.
* Operates as its own Document; no attributes
*
* @author hansonr
*
*/
public class JTextPane extends JComponent implements Document {
public JTextPane() {
super("txtJTP");
text = "";
}
public Document getDocument() {
return this;
}
@Override
public void insertString(int i, String s, Object object) {
i = Math.min(i, text.length());
text = text.substring(0, i) + s + text.substring(i);
}
@Override
public String toHTML() {
SB sb = new SB();
sb.append("");
return sb.toString();
}
}