All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javajs.swing.JTextPane Maven / Gradle / Ivy

There is a newer version: 14.31.10
Show newest version
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();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy