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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
| import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.IOException;
public class SaisiInfo extends JFrame {
private JPanel contentPane;
private JTextField source;
private JTextField destination;
private JTextField timer;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SaisiInfo frame = new SaisiInfo();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public SaisiInfo() {
setTitle("Timer Folder");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("Adresse du dossier source");
lblNewLabel.setBounds(20, 51, 159, 14);
contentPane.add(lblNewLabel);
source = new JTextField();
source.setText("C:\\...");
source.setBounds(189, 48, 216, 20);
contentPane.add(source);
source.setColumns(10);
JLabel lblAdresseDestination = new JLabel("Adresse du dossier de destination");
lblAdresseDestination.setBounds(20, 100, 162, 14);
contentPane.add(lblAdresseDestination);
destination = new JTextField();
destination.setToolTipText("");
destination.setText("C:\\...");
destination.setBounds(189, 97, 216, 20);
contentPane.add(destination);
destination.setColumns(10);
JButton btnStart = new JButton("START");
btnStart.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (source.getText()!=null && destination.getText()!=null && timer.getText()!=null){
String src= source.getText();
String dst= destination.getText();
int time= (Integer.parseInt(timer.getText())*1000);
try {
Appli start = new Appli(src, dst, time);
} catch (IOException | InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
});
btnStart.setBounds(201, 192, 111, 23);
contentPane.add(btnStart);
JButton btnStop = new JButton("STOP");
btnStop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
btnStop.setBounds(322, 192, 66, 23);
contentPane.add(btnStop);
JLabel lblTempsDattente = new JLabel("Temps d'attente (secondes)");
lblTempsDattente.setBounds(20, 152, 159, 14);
contentPane.add(lblTempsDattente);
timer = new JTextField();
timer.setBounds(189, 149, 75, 20);
contentPane.add(timer);
timer.setColumns(10);
JLabel lblS = new JLabel("s");
lblS.setBounds(266, 152, 46, 14);
contentPane.add(lblS);
}
} |
Partager