Sharing a Document Between JTextComponents : JTextComponent « Swing JFC « Java
- Java
- Swing JFC
- JTextComponent
Sharing a Document Between JTextComponents
import javax.swing.JTextArea;
import javax.swing.text.JTextComponent;
public class Main {
public static void main(String[] argv) {
JTextComponent textComp1 = new JTextArea();
JTextComponent textComp2 = new JTextArea();
textComp2.setDocument(textComp1.getDocument());
}
}
Related examples in the same category