The list of methods to do JTextComponent Column are organized into topic(s).
int
getColumnNumber(JTextComponent editor, int pos) Gets the column number at given position of editor.
if (pos == 0) {
return 0;
Rectangle r = editor.modelToView(pos);
int start = editor.viewToModel(new Point(0, r.y));
int column = pos - start;
return column;
int
getDocumentPosition(JTextComponent editor, int line, int column) Get the closest position within the document of the component that has given line and column.
int lineHeight = editor.getFontMetrics(editor.getFont()).getHeight();
int charWidth = editor.getFontMetrics(editor.getFont()).charWidth('m');
int y = line * lineHeight;
int x = column * charWidth;
Point pt = new Point(x, y);
int pos = editor.viewToModel(pt);
return pos;