QUESTA è LA MIA CLASSE CONTROLLER


codice:
package controller;


import boundary.EditorEpad;
import database.Database;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import strumenti.CustomListModel;


public class ComponentiEpad 
{
        private static Database numeri = new Database();
        private static Database epad2 = new Database();


    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) 
    {
        
        numeri.setNomeDatabase("numeri");
        numeri.connetti();
        
        //epad2.setNomeDatabase("epad2");
        //epad2.connetti();
        
        EditorEpad.start(null);
    }
    
    public static CustomListModel listModel(String nome_lista, String nome_tabella) {
        CustomListModel model = null;
        
        ArrayList<String> elementi = new ArrayList<String>();
        
        switch (nome_lista) {
            case "tabella":
                ResultSet tabella;
             tabella = numeri.getResultSet("SHOW TABLES");
             try
             {
                 while(tabella.next()) 
                 {
                     String str = tabella.getString(1);
                     elementi.add(str);
                     
                 }
             } catch(SQLException e) 
             {
                e.printStackTrace();
             }
            
             model = new CustomListModel(elementi);
            break;
                 case "campi":
                tabella = numeri.getResultSet("DESCRIBE " +nome_tabella+ ";");
                
                try
                {
                    while(tabella.next()) 
                    {
                        String str = tabella.getString(1);
                        elementi.add(str);
                        
                    }
                } catch(SQLException e) 
                {
                   e.printStackTrace();
                }
               
                model = new CustomListModel(elementi);
            break;
        }
        
        return model;
    }
    
}