Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   help me on this code please!! (http://www.go4expert.com/forums/help-code-t20322/)

student123 9Dec2009 21:31

help me on this code please!!
dear brothers
i want some help on this code
i have java database, and this code search in the database forthe intered values
i want to check the input and reteive error message if the intered values not found ...
i will be glad if you give me some hint

__________________________________________________ _____________________


package trainingsectionv1;
import javax.swing.JTable;
import javax.swing.RowFilter;
import javax.swing.table.TableRowSorter;
import org.jdesktop.beansbinding.Converter;
 * Binding converter between String and regex RowFilter (encapsulated by RowSorterToStringConverter).
 *  */
public class RowSorterToStringConverter extends Converter {
    private JTable table;
    public JTable getTable() {
        return table;
    public void setTable(JTable table) {
        this.table = table;
    public Object convertForward(Object value) {
        return value.toString();
    public Object convertReverse(Object mask) {
        TableRowSorter sorter = new TableRowSorter(table.getModel());
        // The following statement makes the filter case-sensitive. If you want
        //filter to work in a case-insensitive way, uncomment the line below, comment
        //the 7 code lines below
        //sorter.setRowFilter(RowFilter.regexFilter(".*" + mask + ".*"));
        //The following 7 lines create a case-insensitive filter. If you want
        //the filter to be case-sensitive, comment them out and uncomment the
        //line above
        String m = mask.toString();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < m.length(); i++) {
            char c = m.charAt(i);
      sorter.setRowFilter(RowFilter.regexFilter(".*" + sb + ".*"));
        return sorter;

All times are GMT +5.5. The time now is 08:58.