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

org.yaoqiang.collaboration.ChatArea Maven / Gradle / Ivy

package org.yaoqiang.collaboration;

import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.SimpleAttributeSet;

/**
 * ChatArea
 * 
 * @author Shi Yaoqiang([email protected])
 */
public class ChatArea extends JTextPane {

	private static final long serialVersionUID = -7761671557049096578L;

	public SimpleAttributeSet styles = new SimpleAttributeSet();
	
	public void insertText(String text) {
		final Document doc = getDocument();
		try {
			doc.insertString(doc.getLength(), text, styles);
		} catch (BadLocationException e) {
			e.printStackTrace();
		}
        setCaretPosition(doc.getLength());
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy