seguiente… nao to conseguindo mostrar esta &¨$&#¨*$# de tabela fazendo a gui pelo VEP, fazendo por linhas d codigo aparee tudo normal, mas pelo vep quando eu faco jTable(linhas,clonuas) ele da erro dizendo que “linhas” é muito complicado… ja tentei fazer de tudo q é geito e nao consegui fazer a tabela aparecer, alguma ideia ???.. 8O
[code]public class Filmes extends JInternalFrame {
private javax.swing.JPanel jContentPane = null;
private Connection connection;
private JTable jTable = null; // @jve:decl-index=0:visual-constraint="151,41"
private JScrollPane jScrollPane = null;
/**
* This is the default constructor
*/
public Filmes(Connection banco) {
super();
connection = banco;
initialize();
getTable();
show();
}
public void getTable(){
Statement statement;
ResultSet resultSet;
try{
String query = "SELECT * FROM filme";
statement = connection.createStatement();
resultSet = statement.executeQuery(query);
display(resultSet);
statement.close();
}
catch(SQLException sqlex){
sqlex.printStackTrace();
}
}
private void display(ResultSet rs) throws SQLException{
boolean moreRecords = rs.next();
if (!moreRecords){
JOptionPane.showMessageDialog(this,"ResultSet contained no records");
return;
}
Vector colunas = new Vector();
Vector linhas = new Vector();
try{
ResultSetMetaData rsmd = rs.getMetaData();
for(int i=1; i<=rsmd.getColumnCount();++i)
colunas.addElement(rsmd.getColumnName(i));
do{
linhas.addElement(getNextRow(rs,rsmd));
}while(rs.next());
}
catch(SQLException sqlex){
sqlex.printStackTrace();
}
}
private Vector getNextRow(ResultSet rs, ResultSetMetaData rsmd) throws SQLException{
Vector currentRow = new Vector();
for(int i =1; i<=rsmd.getColumnCount();++i)
currentRow.addElement(rs.getString(i));
return currentRow;
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(425, 237);
this.setContentPane(getJContentPane());
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private javax.swing.JPanel getJContentPane() {
if(jContentPane == null) {
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJScrollPane(), null);
}
return jContentPane;
}
/**
* This method initializes jTable
*
* @return javax.swing.JTable
*/
private JTable getJTable() {
if (jTable == null) {
jTable = new JTable();
}
return jTable;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setBounds(61, 25, 282, 104);
jScrollPane.setViewportView(getJTable());
}
return jScrollPane;
}
} // @jve:decl-index=0:visual-constraint=“19,8”[/code]