Java Swing Document Get Char getCharAt(Document document, int position)

Here you can find the source of getCharAt(Document document, int position)

Description

get Char At

License

Open Source License

Declaration

public static char getCharAt(Document document, int position)
            throws BadLocationException 

Method Source Code

//package com.java2s;

import javax.swing.text.BadLocationException;

import javax.swing.text.Document;

public class Main {
    public static char getCharAt(Document document, int position)
            throws BadLocationException {
        return document.getText(position, 1).charAt(0);
    }/* ww w.  ja  v a 2  s  .co m*/

    public static String getText(Document document) {
        try {
            return document.getText(0, document.getLength());
        } catch (Throwable t) {
            t.printStackTrace();
            return "";
        }
    }
}