JTableUtil.java :  » Database-Client » SQLMinus » util » Java Open Source

Java Open Source » Database Client » SQLMinus 
SQLMinus » util » JTableUtil.java
/*
 * $Author$
 * $Id$
 * This is free software, as software should be; you can redistribute 
 * it and/or modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * See LICENSE.txt for the full license covering this software/program/code.
 */
 
package util;
import java.util.*;
import javax.swing.JTable;

/**
 * Utilities for jtables in sqlminus.
 * @author rahul kumar <rahul_kumar@yahoo.com>
 * @see isql/TableActions.java
 */

public class JTableUtil {


    public static void main (String args[]){ 
    }

    /** returns a list of selected columns, as names.
     */
    public static List getSelectedColumnNames(JTable jt){
        int cols[] = jt.getSelectedColumns();
        List selcols = new ArrayList();
        for( int i = 0; i < cols.length; i++){
            selcols.add( jt.getColumnName(cols[i]).trim());
        }
        return selcols;
    }


    ////// START CONSTANTS AND CLASS LEVEL VARIABLES  //////
    static final String P = "JTableUtil"; // used in exception strings

} // end of class



java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.