Java JTextComponent Column getColumn(int pos, JTextComponent editor)

Here you can find the source of getColumn(int pos, JTextComponent editor)

Description

get Column

License

Open Source License

Declaration

public static int getColumn(int pos, JTextComponent editor) throws BadLocationException 

Method Source Code

//package com.java2s;
/*//from  w ww.j a  v a2  s .c o m
 * Copyright (c) 2011 - 2012. Elega9t Ltd. All rights reserved.
 * ELEGA9T PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.Copyright (c) 2011 - 2012. Elega9t Ltd. All rights reserved.
 */

import javax.swing.text.BadLocationException;
import javax.swing.text.JTextComponent;
import javax.swing.text.Utilities;

public class Main {
    public static int getColumn(int pos, JTextComponent editor) throws BadLocationException {
        return pos - Utilities.getRowStart(editor, pos) + 1;
    }
}

Related

  1. getColumn(JTextComponent editor, int pos)
  2. getColumnAtPosition(JTextComponent editor, int caretPosition)
  3. getColumnNumber(JTextComponent editor, int pos)
  4. getDocumentPosition(JTextComponent editor, int line, int column)