|
|
@ -1,33 +1,83 @@ |
|
|
|
package jorpelu.com; |
|
|
|
|
|
|
|
import java.awt.AWTEvent; |
|
|
|
import java.awt.Event; |
|
|
|
import java.awt.GridLayout; |
|
|
|
import java.awt.TextField; |
|
|
|
import java.awt.event.AWTEventListener; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import javax.swing.JButton; |
|
|
|
import javax.swing.JFrame; |
|
|
|
import javax.swing.JLabel; |
|
|
|
import javax.swing.JOptionPane; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JTextField; |
|
|
|
|
|
|
|
public class Ventana extends JFrame { |
|
|
|
private JLabel titulo, porcentaje, Barra; |
|
|
|
private JTextField ruta; |
|
|
|
private JLabel pideRuta, pideDestino; |
|
|
|
private JTextField rutain, rutaout; |
|
|
|
private JButton confirmar, salir; |
|
|
|
JPanel panel; |
|
|
|
|
|
|
|
public Ventana() { |
|
|
|
Componentes(); |
|
|
|
confirmar.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
if(rutain.getText().equals("") || rutaout.getText().equals("")) { |
|
|
|
JOptionPane.showMessageDialog(null, "Los 2 Campos tienen que estar rellenos"); |
|
|
|
}else { |
|
|
|
|
|
|
|
String r1 = rutain.getText(); |
|
|
|
String r2 = rutaout.getText(); |
|
|
|
try { |
|
|
|
//Thread?? |
|
|
|
MyCopy mc = new MyCopy(r1, r2); |
|
|
|
}catch (IOException e1) { |
|
|
|
e1.printStackTrace(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
salir.addActionListener(new ActionListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
System.exit(EXIT_ON_CLOSE); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Componentes() { |
|
|
|
JPanel panel = new JPanel(); |
|
|
|
JLabel texto = new JLabel("Introduzca la ruta del archivo a copiar: "); |
|
|
|
JTextField ruta = new JTextField(""); |
|
|
|
JButton confirmar = new JButton("Confirmar"); |
|
|
|
texto.setSize(400, 20); |
|
|
|
panel.add(texto); |
|
|
|
panel.add(ruta); |
|
|
|
panel = new JPanel(); |
|
|
|
pideRuta = new JLabel("Introduzca la ruta del archivo a copiar: "); |
|
|
|
pideRuta.setBounds(100, 0, 300, 50); |
|
|
|
rutain = new JTextField(); |
|
|
|
rutain.setBounds(50, 50, 300, 50); |
|
|
|
pideDestino = new JLabel("Introduzca la ruta de destino: "); |
|
|
|
pideDestino.setBounds(100, 100, 300, 50); |
|
|
|
rutaout = new JTextField(); |
|
|
|
rutaout.setBounds(50, 150, 300, 50); |
|
|
|
confirmar = new JButton("Confirmar"); |
|
|
|
confirmar.setBounds(150, 300, 100, 30); |
|
|
|
salir = new JButton("SALIR"); |
|
|
|
salir.setBounds(150,500, 100,30); |
|
|
|
panel.add(pideRuta); |
|
|
|
panel.add(rutain); |
|
|
|
panel.add(pideDestino); |
|
|
|
panel.add(rutaout); |
|
|
|
panel.add(confirmar); |
|
|
|
panel.add(salir); |
|
|
|
add(panel); |
|
|
|
panel.setLayout(new GridLayout(5, 1)); |
|
|
|
panel.setLayout(null); |
|
|
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
|
|
setSize(400, 600); |
|
|
|
setVisible(true); |
|
|
|