22-06-2005, 19:47
|
|
|
חבר מתאריך: 15.06.05
הודעות: 19
|
|
יש משתנה גלובלי, שאותו אני מגדיר לפני קריאה לפונדציה "שאילתא" מטפלת בקריאה למסד נתונים
colums - המשתנה הגלובלי
colums = 5;
shehilta(colNames);
void shehilta(final String[] col_Names) throws SQLException
{
JTable table;
TableModel dataModel = new AbstractTableModel()
{
public int getColumnCount()
{ return colums ;} : פה מוגדרים מס העמודות
public int getRowCount()
{ return resultsVector.size();} : פה מוגדרים מס השורות
public Object getValueAt(int row, int col)
{ return((Vector)
resultsVector.elementAt(row)).elementAt(col);}
public String getColumnName(int column)
{ return col_Names[column];}
};
table = new JTable(dataModel);
table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COL UMNS);
JScrollPane scrollpane = new JScrollPane(table);
getContentPane().add("Center", scrollpane);
וכו'.........
תודה!
|