Here you can find the source of buscarDescripcion(KeyEvent e, JTable pTabla, JTextField pTextoDeBusqueda, int pColumna)
public static boolean buscarDescripcion(KeyEvent e, JTable pTabla, JTextField pTextoDeBusqueda, int pColumna)
//package com.java2s; //License from project: Open Source License import javax.swing.*; import java.awt.*; import java.awt.event.KeyEvent; public class Main { public static boolean buscarDescripcion(KeyEvent e, JTable pTabla, JTextField pTextoDeBusqueda, int pColumna) { boolean findRecord = false; if ((e.getKeyChar() != KeyEvent.CHAR_UNDEFINED) && (e.getKeyCode() != KeyEvent.VK_ENTER)) { String vFindText = pTextoDeBusqueda.getText().toUpperCase(); String vDescrip = ""; for (int k = 0; k < pTabla.getRowCount(); k++) { vDescrip = ((String) pTabla.getValueAt(k, pColumna)) .toUpperCase().trim(); if (vDescrip.length() >= vFindText.length()) { vDescrip = vDescrip.substring(0, vFindText.length()); if (vFindText.equalsIgnoreCase(vDescrip)) { showCell(pTabla, k, 0); findRecord = true; break; }// w ww. ja va2 s . com } } } return findRecord; } public static void showCell(JTable table, int row, int column) { if (row >= table.getRowCount()) row = table.getRowCount() - 1; Rectangle rect = table.getCellRect(row, column, true); table.scrollRectToVisible(rect); table.clearSelection(); table.setRowSelectionInterval(row, row); } }