diff --git a/bin/jorpelu/com/MyCopy.class b/bin/jorpelu/com/MyCopy.class index 7063391..1a3ebbd 100644 Binary files a/bin/jorpelu/com/MyCopy.class and b/bin/jorpelu/com/MyCopy.class differ diff --git a/bin/jorpelu/com/Ventana.class b/bin/jorpelu/com/Ventana.class index 88dcf7f..e68c381 100644 Binary files a/bin/jorpelu/com/Ventana.class and b/bin/jorpelu/com/Ventana.class differ diff --git a/bin/jorpelu/com/Ventana2.class b/bin/jorpelu/com/Ventana2.class new file mode 100644 index 0000000..30e4719 Binary files /dev/null and b/bin/jorpelu/com/Ventana2.class differ diff --git a/src/jorpelu/com/MyCopy.java b/src/jorpelu/com/MyCopy.java index 485e5a2..34d489b 100644 --- a/src/jorpelu/com/MyCopy.java +++ b/src/jorpelu/com/MyCopy.java @@ -2,24 +2,27 @@ package jorpelu.com; import java.io.*; import java.util.ArrayList; -import java.util.Scanner; import javax.swing.JFrame; import javax.swing.JPanel; public class MyCopy { - static Scanner sc = new Scanner(System.in); - public MyCopy(String Ruta, JFrame jf){ - String ficheroString = sc.next(); - File fich = new File(".\\Salida.dat"); - File fich_a_copiar = new File(ficheroString); + public MyCopy(String RutaIn, JFrame jf, String RutaOut){ + + if(RutaOut==null) { + RutaOut = "."; + } + File fich = new File(RutaOut); + File fich_a_copiar = new File(RutaIn); + + if(fich_a_copiar.exists() == false) { try { fich_a_copiar.createNewFile(); } catch (IOException e) { - // TODO Auto-generated catch block + e.printStackTrace(); } } diff --git a/src/jorpelu/com/Ventana.java b/src/jorpelu/com/Ventana.java index e933925..1a988eb 100644 --- a/src/jorpelu/com/Ventana.java +++ b/src/jorpelu/com/Ventana.java @@ -1,45 +1,11 @@ package jorpelu.com; -import java.awt.FlowLayout; -import java.awt.GridLayout; - -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; +import javax.swing.*; public class Ventana extends JFrame{ private JLabel titulo, porcentaje, Barra; private JTextField ruta; - public static void main(String[] args) { - new Ventana(); - - - } - - public Ventana() { - - Componentes(); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - setSize(400,600); - setVisible(true); - setTitle("**Copiador de Archivos**"); - } - 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.add(confirmar); - add(panel); - panel.setLayout(new GridLayout(5,1)); - - } } diff --git a/src/jorpelu/com/Ventana2.java b/src/jorpelu/com/Ventana2.java new file mode 100644 index 0000000..73df5ff --- /dev/null +++ b/src/jorpelu/com/Ventana2.java @@ -0,0 +1,45 @@ +package jorpelu.com; + +import java.awt.FlowLayout; +import java.awt.GridLayout; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +public class Ventana2 extends JFrame{ + private JLabel titulo, porcentaje, Barra; + private JTextField ruta; + + public static void main(String[] args) { + new Ventana2(); + + + } + + public Ventana2() { + + Componentes(); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setSize(400,600); + setVisible(true); + setTitle("**Copiador de Archivos**"); + } + + 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.add(confirmar); + add(panel); + panel.setLayout(new GridLayout(5,1)); + + } + +}