Example usage for javax.swing JTextArea replaceRange

List of usage examples for javax.swing JTextArea replaceRange

Introduction

In this page you can find the example usage for javax.swing JTextArea replaceRange.

Prototype

public void replaceRange(String str, int start, int end) 

Source Link

Document

Replaces text from the indicated start to end position with the new text specified.

Usage

From source file:Main.java

public static void main(String[] argv) {
    JTextArea ta = new JTextArea("Initial Text");
    int start = 0;
    int end = 3;/*ww w. j av  a2  s  .c  o m*/
    ta.replaceRange("new text", start, end);
}

From source file:Main.java

public static void main(String[] argv) {
    JTextArea ta = new JTextArea("Initial Text");
    int start = 0;
    int end = 5;/*from www  .j a  v  a  2s . c  om*/
    ta.replaceRange(null, start, end);
}