1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
public class Fenetre extends JFrame {
public Fenetre() throws Exception {
String j1;
String j2;
String datDebFormat = null;
String datFinFormat = null
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("JTable");
this.setSize(800, 600);
Container c;
c = getContentPane();
c.setLayout(new BorderLayout());
JPanel inputPanel = new JPanel();
inputPanel.setPreferredSize(new Dimension(800, 600));
JLabel jLabel10 = new JLabel();
jLabel10.setBounds(new Rectangle(30, 248, 132, 25));
jLabel10.setText(" De : ");
inputPanel.add(jLabel10);
JTextField da = new JTextField(8);
inputPanel.add(da);
JLabel jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(447, 119, 102, 37));
jLabel1.setText(" A : ");
inputPanel.add(jLabel1);
JTextField te = new JTextField(8);
inputPanel.add(te);
JButton jButton = new JButton();
jButton.setBounds(new Rectangle(137, 100, 80, 50));
jButton.setText("OK");
inputPanel.add(jButton);
c.add(inputPanel);
JPanel tabPan = new JPanel();
DaoClient aa = new DaoClient("sa", "1302", "Sonalgaz");
ResultSet rs = aa.afficherClient( datDebFormat, datFinFormat);// resultat de select from table
ResultSet rs1 = aa.nbreLigne();// pr copter le nbre de ligne
afficher a = new afficher();
final JTable tt= a.remplir(rs, rs1);
inputPanel.add(tt).setVisible(false);
c.add(inputPanel);
jButton.addMouseListener(new java.awt.event.MouseAdapter(){
public void mouseClicked(java.awt.event.MouseEvent e) {
DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
j1 = da.getText();
j2 = te.getText();
try{
Date d1 = (Date) sdf.parse(j1);
Date d2 = (Date) sdf.parse(j2);
datDebFormat= sdf.format(d1); La est l'erreur
datFinFormat= sdf.format(d2);
inputPanel.add(tt).setVisible(true);
}
});
}
} |
Partager