diff --git a/README.md b/README.md index c8f4d70..6d805d7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # MiVentana +~~~ + +~~~ \ No newline at end of file diff --git a/bin/jorpelu/com/MyCopy.class b/bin/jorpelu/com/MyCopy.class index 85b8714..cdb7444 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 deleted file mode 100644 index e68c381..0000000 Binary files a/bin/jorpelu/com/Ventana.class and /dev/null differ diff --git a/bin/jorpelu/com/main.class b/bin/jorpelu/com/main.class new file mode 100644 index 0000000..3c497a6 Binary files /dev/null and b/bin/jorpelu/com/main.class differ diff --git a/src/jorpelu/com/MyCopy.java b/src/jorpelu/com/MyCopy.java index cd95e76..21ed3d7 100644 --- a/src/jorpelu/com/MyCopy.java +++ b/src/jorpelu/com/MyCopy.java @@ -1,64 +1,87 @@ package jorpelu.com; +import java.awt.GridLayout; +import java.awt.PopupMenu; import java.io.*; -import java.io.File; import java.util.ArrayList; -import java.util.Scanner; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.JTextField; -public class MyCopy { - Ventana ventana; + +public class MyCopy extends JFrame{ - public static void main(String[] args) throws FileNotFoundException, IOException { - File fich = new File(".\\Salida.dat"); - File fich_a_copiar = new File("textp.dat"); + public MyCopy(String RutaIn, String RutaOut) throws IOException { + + /* + * Componentes de Ventana de caarga + */ + JLabel Porcentaje = new JLabel(); + Porcentaje.setBounds(100,0,20,200); + add(Porcentaje); + JProgressBar barra = new JProgressBar(); + barra.setBounds(100, 20, 150, 10); + add(barra); + /* + * Variables para copiar + */ + File fich = new File(RutaOut); + File fich_a_copiar = new File(RutaIn); if(fich_a_copiar.exists() == false) { fich_a_copiar.createNewFile(); } - String[] calculando = {"-", "\\", "|", "/"}; - FileInputStream in = new FileInputStream(fich_a_copiar); DataInputStream din = new DataInputStream(in); FileOutputStream out = new FileOutputStream(fich); DataOutputStream dout = new DataOutputStream(out); + String[] calculando = {"-", "\\", "|", "/"}; int cal=0; int i=0; int c; ArrayList bufferin = new ArrayList(); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setSize(400,100); + setLocationRelativeTo(null); + setLayout(null); + setResizable(false); + setVisible(true); + setTitle("Copiando"); + + + try { while((c = din.read() ) != -1 && bufferin.add(c)) { - System.out.println(calculando[cal]); + Porcentaje.setText(calculando[cal]); cal++; if (cal >= 4) cal = 0; - - try { - Thread.sleep(100); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + Thread.sleep(100); } for(int j = 0; j