下面列出了javax.swing.event.CaretEvent#getMark() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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();
}
public void caretUpdate(CaretEvent evt) {
if (evt.getDot() != evt.getMark()) {
surroundsWithTimer.setInitialDelay(SURROUND_WITH_DELAY);
surroundsWithTimer.restart();
} else {
surroundsWithTimer.stop();
hideSurroundWithHint();
}
}
@Override
public void caretUpdate(CaretEvent ce) {
final int dot = ce.getDot();
final int mark = ce.getMark();
this.main.setCaretStatus(dot, mark);
}