Esempio 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);
 }
Esempio n. 2
0
 public void caretUpdate(CaretEvent e) {
   try {
     setLineCount(textArea.getLineOfOffset(e.getDot()) + 1);
   } catch (BadLocationException blx) {
     logger.warn("BadLocationException: " + blx.getMessage());
   }
 }
  public void caretUpdate(CaretEvent e) {
    if (!isPopupVisible() && tf.isShowing() && tf.hasFocus()) {
      showPopup();
    }

    JTextField tf = (JTextField) e.getSource();
    String text = tf.getText().toLowerCase();

    int index = -1;
    for (int i = 0; i < super.getItemCount(); i++) {
      String item = ((String) getItemAt(i)).toLowerCase();
      if (item.startsWith(text)) {
        index = i;
        break;
      }
    }
    if (index != -1) {
      comboUi.getList().setSelectedIndex(index);
    } else {
      comboUi.getList().clearSelection();
    }

    newValue = comboUi.getList().getSelectedValue();
    System.out.println("new value set to: " + newValue);
  }
 @Override
 public void caretUpdate(CaretEvent e) {
   Object source = e.getSource();
   if (source == textArea) {
     possiblyDisposeOfTipWindow();
   }
 }
Esempio n. 5
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;
   }
 }
Esempio n. 6
0
  /** Listen for text movements in the N & X fields * */
  public void caretUpdate(CaretEvent e) {

    clearResidueAndJacobi();

    if (e.getSource() == nField) {
      p = null;
      q = null;
      pLabel.setText("    p = ?");
      qLabel.setText("    q = ?");
    }
  }
Esempio n. 7
0
 @Override
 public void caretUpdate(CaretEvent event) {
   doCaretUpdate(event.getDot(), event.getMark());
 }
Esempio n. 8
0
  /**
   * Caret Listener
   *
   * @param e event
   */
  public void caretUpdate(CaretEvent e) {
    log.finest("Dot=" + e.getDot() + ",Last=" + m_lastDot + ", Mark=" + e.getMark());
    //	Selection
    if (e.getDot() != e.getMark()) {
      m_lastDot = e.getDot();
      return;
    }
    //

    //	Is the current position a fixed character?
    if (e.getDot() + 1 > m_mask.length() || m_mask.charAt(e.getDot()) != DELIMITER) {
      m_lastDot = e.getDot();
      return;
    }

    //	Direction?
    int newDot = -1;
    if (m_lastDot > e.getDot()) // 	<-
    newDot = e.getDot() - 1;
    else //	-> (or same)
    newDot = e.getDot() + 1;
    if (e.getDot() == 0) // 	first
    newDot = 1;
    else if (e.getDot() == m_mask.length() - 1) // 	last
    newDot = e.getDot() - 1;
    //
    log.fine(
        "OnFixedChar=" + m_mask.charAt(e.getDot()) + ", newDot=" + newDot + ", last=" + m_lastDot);
    //
    m_lastDot = e.getDot();
    if (newDot >= 0 && newDot < getText().length()) m_tc.setCaretPosition(newDot);
  } //	caretUpdate
Esempio n. 9
0
 @Override
 public void caretUpdate(CaretEvent e) {
   if (e.getSource() == searchField) {
     updateSearchButtonText();
   }
 }
 public void caretUpdate(CaretEvent e) {
   // todo: paint only interested region
   ((JTextComponent) e.getSource()).repaint();
 }