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 84 85 86
|
public class Temps extends JPanel implements ActionListener{
JLabel tempsDebut;
JLabel tempsFin;
private saisieTD;
private JFormattedTextField saisieTF ;
// JTextField saisieTD;
//JTextField saisieTF;
JButton valider;
Fichiers list;
public Temps() {
this.setBackground(Color.CYAN);
tempsDebut = new JLabel();
tempsDebut.setText("entrer un temps de debut");
saisieTD =new JFormattedTextField(DateFormat.getDateInstance());
saisieTD.setPreferredSize(new Dimension(100,30));
// saisieTD.getDocument().addDocumentListener(this);
// Calendar test = new GregorianCalendar();
// System.out.println(test.getTime().toString());
add(saisieTD);
add(tempsDebut);
tempsFin = new JLabel("entrer un temps de fin");
saisieTF =new JFormattedTextField(DateFormat.getDateInstance());
saisieTF.setPreferredSize(new Dimension(100,30));
//saisieTF.getDocument().addDocumentListener(this);
add(saisieTF);
add(tempsFin);
valider= new JButton("valider");
valider.addActionListener(new BoutonListener());
add(valider);
}
/**
* @param args the command line arguments
* @throws ParseException
*/
public String findFile( Date td,Date tf) {
String nom=null;
String debut = DateFormat.getDateInstance().format(td);
String fin = DateFormat.getDateInstance().format(tf);
if(list.contientFichiers(debut)){
if(list.contientFichiers(fin)){
{ nom=list.fetches(fin);}
}
}
return nom;
}
public static void main(String[] args) {
JFrame f = new JFrame();
f.setSize(600, 400);
f.getContentPane().add(new Temps());
f.setVisible(true);
}
class BoutonListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
System.out.println(saisieTD) ;
System.out.println(saisieTF) ;
}
}
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
} |
Partager