List of usage examples for java.text FieldPosition getBeginIndex
public int getBeginIndex()
From source file:DateTimeEditor.java
private FieldPosition getNextField(int caretLoc) { FieldPosition fieldPosition = null; for (Iterator iter = m_fieldPositions.iterator(); iter.hasNext();) { FieldPosition chkFieldPosition = (FieldPosition) iter.next(); if (chkFieldPosition.getBeginIndex() > caretLoc) { fieldPosition = chkFieldPosition; break; }//from www .j av a 2s. c om } return (fieldPosition); }
From source file:DateTimeEditor.java
private FieldPosition getField(int caretLoc) { FieldPosition fieldPosition = null; for (Iterator iter = m_fieldPositions.iterator(); iter.hasNext();) { FieldPosition chkFieldPosition = (FieldPosition) iter.next(); if ((chkFieldPosition.getBeginIndex() <= caretLoc) && (chkFieldPosition.getEndIndex() > caretLoc)) { fieldPosition = chkFieldPosition; break; }// w w w .j a v a 2 s. co m } return (fieldPosition); }
From source file:DateTimeEditor.java
private int getFieldBeginIndex(int fieldNum) { int beginIndex = -1; for (Iterator iter = m_fieldPositions.iterator(); iter.hasNext();) { FieldPosition fieldPos = (FieldPosition) iter.next(); if (fieldPos.getField() == fieldNum) { beginIndex = fieldPos.getBeginIndex(); break; }/* www . j ava 2s. c o m*/ } return (beginIndex); }
From source file:DateTimeEditor.java
private void setCurField() { FieldPosition fieldPosition = getField(m_caret.getDot()); if (fieldPosition != null) { if (m_caret.getDot() != fieldPosition.getBeginIndex()) m_caret.setDot(fieldPosition.getBeginIndex()); } else {/*from w w w. j a v a 2 s .c o m*/ fieldPosition = getPrevField(m_caret.getDot()); if (fieldPosition != null) m_caret.setDot(fieldPosition.getBeginIndex()); else { fieldPosition = getFirstField(); if (fieldPosition != null) m_caret.setDot(fieldPosition.getBeginIndex()); } } if (fieldPosition != null) m_curField = fieldPosition.getField(); else m_curField = -1; }