0% found this document useful (0 votes)
2 views1 page

Tugas 5

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Tugas 5

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

FROM UTAMA
private void btnsiswaActionPerformed(java.awt.event.ActionEvent evt) {
dp.removeAll();
fromsiswa siswa=new fromsiswa();
dp.add(siswa);
siswa.show();
}

2. FROM SISWA
public class fromsiswa extends javax.swing.JInternalFrame {

/**
* Creates new form fromsiswa
*/
private final DefaultTableModel model;
public fromsiswa() {
initComponents();

model=new DefaultTableModel();
tblsiswa.setModel(model);
model.addColumn("N I S");
model.addColumn("Nama Siswa");
model.addColumn("Kota");
getdata();
}
public void getdata() {
model.getDataVector().removeAllElements();
model.fireTableDataChanged();
try{
Statement stat=(Statement) db_sekolahly.getkoneksi().createStatement();
String sql="select * from tbsiswa";
ResultSet res=stat.executeQuery(sql);
while(res.next()){
Object [] obj=new Object[3];
obj[0]=res.getString("nis");
obj[1]=res.getString("nama");
obj[2]=res.getString("kota");
model.addRow(obj);
}
}catch(SQLException err) {

JOptionPane.showMessageDialog(null, err.getMessage());
}
}

ISI DARI TABLENYA


1. jLabel = INFORMASI DATA SISWA =-
2. jTable = - = tblsiswa

You might also like