public void gerar(String ip, String banco, String usuario, String senha, String tabela, JEditorPane classe, JEditorPane insercao, JEditorPane remocao, JEditorPane cargaobjeto, JEditorPane leituraObjeto, JEditorPane metodoBuscar) {
        ResultSet rs = null;
        ResultSetMetaData rsmd = null;
        Connection con = null;
        Statement stmt = null;
        try {
            StringBuilder textoClasse = new StringBuilder();
            Class.forName("org.postgresql.Driver").newInstance();
            DriverManager.setLoginTimeout(5);
            String url = "jdbc:postgresql://" + ip + "/" + banco;
            con = DriverManager.getConnection(url, usuario, senha);
            stmt = con.createStatement();
            rs = stmt.executeQuery("SELECT * from " + tabela + " limit 1");
            rsmd = rs.getMetaData();
            int columnCount = rsmd.getColumnCount();
            StringBuilder complemento = new StringBuilder();
            textoClasse.append("\n");
            textoClasse.append("\npublic class " + tabela + " implements Serializable{");
            for (int i = 1; i < columnCount + 1; i++) {
                String name = rsmd.getColumnName(i);
                String nameType = sqlTypeToJavaType(rsmd.getColumnType(i));
                textoClasse.append("\n    private " + nameType + " " + name + ";");
                complemento.append("\n    public void set" + name + "(" + nameType + " " + name + "){");
                complemento.append("\n        this." + name + " = " + name + ";");
                complemento.append("\n    }\n");
                complemento.append("\n    public " + nameType + " get" + name + "(){");
                complemento.append("\n        return this." + name + ";");
                complemento.append("\n    }");
            }
            textoClasse.append("\n");
            textoClasse.append(complemento);
            textoClasse.append("\n");
            textoClasse.append("}");

            classe.setText(textoClasse.toString());

            DatabaseMetaData dm = con.getMetaData();
            String pkey = "<Não encontrou a chave>";
            ResultSet rsMeta = dm.getExportedKeys("", "", tabela);
            while (rsMeta.next()) {
                pkey = rsMeta.getString("PKCOLUMN_NAME");
            }
            rsMeta.close();

            insercao.setText(criarMetodoSalvarAtualizar(tabela, rsmd, pkey));
            cargaobjeto.setText(criarObjetoCarga(tabela, rsmd));
            leituraObjeto.setText(criarLeituraObjeto(tabela, rsmd));
            remocao.setText(criarMetodoExcluir(tabela, pkey));
            metodoBuscar.setText(criarMetodoBuscar(tabela, rsmd, pkey));

        } catch (Exception ex) {
            throw new RuntimeException(ex.getMessage());
        } finally {
            if (rs != null) {
                try {
                    rs.close();
                } catch (SQLException ex) {
                }
            }
            if (stmt != null) {
                try {
                    stmt.close();
                } catch (SQLException ex) {
                }
            }
            if (con != null) {
                try {
                    con.close();
                } catch (SQLException ex) {
                }
            }
        }
    }