Java Code Examples for javax.swing.event.CaretEvent#getMark()

The following examples show how to use javax.swing.event.CaretEvent#getMark() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextPanelCaretListener.java    From mae-annotation with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void caretUpdate(CaretEvent e) {

    try {
        if (e.getDot() != e.getMark()) { // that is, mouse is dragged and text is selected
            addDraggedSelection(e.getDot(), e.getMark());
        } else if (mainController.getMode() == MaeMainController.MODE_MULTI_SPAN) {
            // MSPAN mode always ignore single click
        } else {
            if (mainController.getMode() == MaeMainController.MODE_NORMAL) {
                textPanelController.clearSelection(); // single click will clear out prev selection
            }
            if (acceptingSingleClick()) {
                textPanelController.addSelection(new int[]{e.getDot(), e.getDot() + 1});
            }
        }
    } catch (MaeDBException ex) {
        mainController.showError(ex);
    }
    textPanelController.repaintBGColor();
    mainController.propagateSelectionFromTextPanel();
}
 
Example 2
Source File: AbbrevDetection.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void caretUpdate(CaretEvent evt) {
    if (evt.getDot() != evt.getMark()) {
        surroundsWithTimer.setInitialDelay(SURROUND_WITH_DELAY);
        surroundsWithTimer.restart();
    } else {
        surroundsWithTimer.stop();
        hideSurroundWithHint();
    }
}
 
Example 3
Source File: CaretChangeHandler.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
@Override
public void caretUpdate(CaretEvent ce) {
  final int dot = ce.getDot();
  final int mark = ce.getMark();
  this.main.setCaretStatus(dot, mark);
}