64 lines
1.8 KiB
Java
64 lines
1.8 KiB
Java
package siba.gui;
|
|
|
|
import javax.swing.JPanel;
|
|
import javax.swing.JLabel;
|
|
import javax.swing.SwingConstants;
|
|
import javax.swing.JButton;
|
|
import javax.swing.JFileChooser;
|
|
|
|
import java.awt.event.MouseAdapter;
|
|
import java.awt.event.MouseEvent;
|
|
import java.io.File;
|
|
|
|
import javax.swing.filechooser.*;
|
|
import javax.swing.plaf.basic.BasicFileChooserUI;
|
|
|
|
public class BackupPanel extends JPanel
|
|
{
|
|
|
|
/**
|
|
* Create the panel.
|
|
*/
|
|
public BackupPanel()
|
|
{
|
|
|
|
JButton btnNewButton = new JButton("Choix du répertoire");
|
|
btnNewButton.addMouseListener(new MouseAdapter() {
|
|
@Override
|
|
public void mouseClicked(MouseEvent e) {
|
|
final JFileChooser fc = new JFileChooser();
|
|
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
|
int returnVal = fc.showDialog(BackupPanel.this,"Répertoire à sauvegarder");
|
|
if (returnVal == JFileChooser.APPROVE_OPTION){
|
|
File file = fc.getSelectedFile();
|
|
System.out.println("Répertoire chosi " + file.getPath());
|
|
}
|
|
}
|
|
});
|
|
|
|
JLabel lblNewLabel = new JLabel("Répertoire à sauvegarder");
|
|
lblNewLabel.setHorizontalAlignment(SwingConstants.LEFT);
|
|
lblNewLabel.setVerticalAlignment(SwingConstants.TOP);
|
|
add(lblNewLabel);
|
|
add(btnNewButton);
|
|
|
|
JButton btnNewButton_1 = new JButton("Répertoire de destination");
|
|
btnNewButton_1.addMouseListener(new MouseAdapter() {
|
|
@Override
|
|
public void mouseClicked(MouseEvent e1) {
|
|
final JFileChooser fc1 = new JFileChooser();
|
|
fc1.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
|
int returnVal = fc1.showDialog(BackupPanel.this,"Répertoire de destination");
|
|
if (returnVal == JFileChooser.APPROVE_OPTION){
|
|
File file = fc1.getSelectedFile();
|
|
System.out.println("Répertoire chosi " + file.getPath());
|
|
}
|
|
}
|
|
});
|
|
btnNewButton_1.setHorizontalAlignment(SwingConstants.LEADING);
|
|
add(btnNewButton_1);
|
|
|
|
}
|
|
|
|
}
|