package Project;
import java.awt.GridLayout;
import java.sql.SQLException;
import javax.sql.RowSet;
import javax.sql.rowset.CachedRowSet;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class TaskDashboard {
private JFrame fenetre;
private JLabel affichage;
private JLabel affichageb;
public JTextField champA;
private int idp;
TaskDashboard(int idp){
System.out.print("tasks");
this.fenetre = new JFrame("Task Dashboard");
this.fenetre.setSize(600, 600);
this.fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.fenetre.setLocationRelativeTo(null);
/*
CachedRowSet crs = null;
Sending send = new Sending();
crs = send.getAllProjects("SELECT id FROM projects WHERE name = "+name);
try {idp = crs.getInt(1);}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.print(idp);
*/
CachedRowSet crss = null;
Sending sendi = new Sending();
crss = sendi.getAllProjects("SELECT * FROM tasks WHERE projectid = "+idp);
this.fenetre.setLayout(new GridLayout(crss.size(),1));
try {
do
{
System.out.print("test");
int id = crss.getInt(1);
String idproj =crss.getString(2);
String completed =crss.getString(3);
String desc =crss.getString(4);
this.affichage = new JLabel();
this.affichageb = new JLabel();
this.affichage.setText("Id
Id Projet
Completed
Description_");
this.affichageb.setText(""+id+"
"+idproj+"
"+completed+"
"+desc+"");
this.fenetre.add(affichage);
this.fenetre.add(affichageb);
System.out.print(id+idproj+completed+desc);
}
while (crss.next ());
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this.fenetre.setVisible(true);
this.fenetre.pack();
}
}