Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.awt.Color;

import javax.swing.JTextArea;
import javax.swing.text.JTextComponent;

public class Main {
    public static void main(String[] argv) throws Exception {
        JTextComponent c = new JTextArea();
        c.getCaretPosition();
        if (c.getCaretPosition() < c.getDocument().getLength()) {
            char ch = c.getText(c.getCaretPosition(), 1).charAt(0);
        }
        // Move the caret
        int newPosition = 0;
        c.moveCaretPosition(newPosition);
    }
}