@Override public void caretUpdate(CaretEvent e) { Object source = e.getSource(); if (source == textArea) { possiblyDisposeOfTipWindow(); } }
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); }
/** 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 = ?"); } }
@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(); }