Ejemplo n.º 1
0
 public void caretUpdate(CaretEvent e) {
   // when the cursor moves on _textView
   // this method will be called. Then, we
   // must determine what the line number is
   // and update the line number view
   Element root = textView.getDocument().getDefaultRootElement();
   int line = root.getElementIndex(e.getDot());
   root = root.getElement(line);
   int col = root.getElementIndex(e.getDot());
   lineNumberView.setText(line + ":" + col);
   // if text is selected then enable copy and cut
   boolean isSelection = e.getDot() != e.getMark();
   copyAction.setEnabled(isSelection);
   cutAction.setEnabled(isSelection);
 }
Ejemplo n.º 2
0
 public void caretUpdate(CaretEvent e) {
   int dot = e.getDot();
   int mark = e.getMark();
   if (dot == mark) { // no selection
     if (caretValue != dot) {
       caretValue = dot;
     }
     if (debug && caretCmd != null) System.out.println("caret @: " + caretValue);
     if (hasFocus()) {
       // Update widget and vnmr variables every time something
       // happens in the widget
       sendTextCmd();
       sendCaretCmd();
     }
     return;
   }
 }
Ejemplo n.º 3
0
 @Override
 public void caretUpdate(CaretEvent event) {
   doCaretUpdate(event.getDot(), event.getMark());
 }