12 Mayıs 2016 Perşembe

Jtable'da listeleme nasıl yapılır?



Kullanılan kodlar :

DAO KISMI :

private TableModel tablo = new TableModel() {
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
// TODO Auto-generated method stub
}
@Override
public void removeTableModelListener(TableModelListener l) {
// TODO Auto-generated method stub
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
// TODO Auto-generated method stub
return false;
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
// TODO Auto-generated method stub
return null;
}


@Override
public int getRowCount() {
// TODO Auto-generated method stub
return 0;
}
@Override
public String getColumnName(int columnIndex) {
// TODO Auto-generated method stub
return null;
}
@Override
public int getColumnCount() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Class<?> getColumnClass(int columnIndex) {
// TODO Auto-generated method stub
return null;
}
@Override
public void addTableModelListener(TableModelListener l) {
// TODO Auto-generated method stub
}
};


GUI KISMI:

public Object [] getObjects(){
       
        Object [] listveriler = {id,konuadi};
      
        return listveriler;
  }
for(DersEkleDomain list : DersDao.listele()){
           
            ((DefaultTableModel) tablemodel).addRow(list.getObjects());
          
      }

Hiç yorum yok:

Yorum Gönder