From badc4369358a8f5e19b4766bfff9edd96744b18c Mon Sep 17 00:00:00 2001 From: Ivan Morell Date: Tue, 11 Oct 2022 16:41:54 +0200 Subject: [PATCH] My window maker --- .classpath | 10 ++ .project | 17 +++ .settings/org.eclipse.core.resources.prefs | 2 + .settings/org.eclipse.jdt.core.prefs | 14 ++ bin/Package/MyAplication$1.class | Bin 0 -> 823 bytes bin/Package/MyAplication$2.class | Bin 0 -> 1084 bytes bin/Package/MyAplication.class | Bin 0 -> 4201 bytes bin/module-info.class | Bin 0 -> 179 bytes src/Package/MyAplication.java | 156 +++++++++++++++++++++ src/module-info.java | 10 ++ 10 files changed, 209 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 bin/Package/MyAplication$1.class create mode 100644 bin/Package/MyAplication$2.class create mode 100644 bin/Package/MyAplication.class create mode 100644 bin/module-info.class create mode 100644 src/Package/MyAplication.java create mode 100644 src/module-info.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..57bca72 --- /dev/null +++ b/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..aa0e181 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + MyWindowsBuilder + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..8c9943d --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,14 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/bin/Package/MyAplication$1.class b/bin/Package/MyAplication$1.class new file mode 100644 index 0000000000000000000000000000000000000000..2ea9945fc418a9942aa08c839c97a5e250d8b1f1 GIT binary patch literal 823 zcmZuvYikoh6g`t{vgvkfn@4Nvt5K^ajW!h@2vI>wi%L?(lz{qavKiB<$!^%)*b4q1 zKNqA01%H4)N<6y>ZG|k%&V9|f_nv$I{QdbGz%y)^NC+&wmCk3`Q?=&T7sI}GWT-uN z^}Y#1U}0Z=k+r^bd$l*6edUBE(gL|N>${Qb%1&Piq@QY6htCC)Cd4qlOW6Hg3fI4t?#0t&rsI`qGIQV&<-QK*pyw$JPX+7UMd{oS$OS zHy1-S<#0lj)$&HZqqcQKe)jzA)}x|G_?GMRy@1^|Rk-JMZQR8@4rU;=%Noib&n0Sw zEVfsV24}x=UFC1~We_M1BD14{@TC`oD1qGbq_{f?9!{0o45b=x!8^5f0_!Mt+x(|v z;|As^+v5OSz&tfB*6HJK1dHI7esVXe@8S%&F!mmeutG)1V~6<daH6yt-(Ya;l2USY`TiwAMkh((gT=0sk&jMzLs)3_HhlzxL3tl z(?Ttms}}C#fr%o8yxw>l5Ale>YzVb2jujPED!1v<7qF#b5^32&8M7uFI_{>fjXBIy zi~Q)|gkhzV&qadkl$RB_+HFP+n)+8+4Axe382jR_)Xf~c_>dQLnbfJZ&<~=7@?RHf zH>%rsqV=%!bCEodUkPWw59#@?20Tdw^}TOHBNeomvt* zwIntDRT&xs$kFXQd2eXlOSa(5wlL_-wJ_|=w=n8V8ZC@F-!b_u#Z1whB@7T@nr1uo z3%HFLS~1GtZin#`j5J2UIVHkV44>g1nbEcxKSSx9(MoSBOrn{xj}$saEaHz cB1Oqy2^F#i>H8Q@$+PH8=cK=9G%_gv0TEFIH2?qr literal 0 HcmV?d00001 diff --git a/bin/Package/MyAplication.class b/bin/Package/MyAplication.class new file mode 100644 index 0000000000000000000000000000000000000000..d2c8e98c6e9d355b7f76b0139c8d204635ed13fc GIT binary patch literal 4201 zcmai1Yj_mp6@F*4yR$nPAcTvophTfI1VWTrtO+6z2?jS8NDQt>ak4u}26lJ0yR!)( zYO7dntM*>RS}L^_+A1wpHrBP;Vq03<+8e!4d$sm{{nO{^FX?+`XOmqLpYnvv%=ew^ zd){-tFE73R?DGJw!M|1b6wK{4;=7Guv!!eA`b^S_8;)hCRrnRu?J`DD4)x8G+{Z5ku#kQc0Qe;Rkg8`{{)dGXx6b3 zEi4fCuQP{?e9~!8+Bvf)V`kmrGnPims$g;ER=Mml)AS3z$P!$sat3~6e! zx2Ygf!f=8e-Ud-r@iqmsrNlWYQom6_Q-zUsJC(81%*4yui=e!yVjI(|0=|#U?&hswKzDC|LfeIYcl$f0KPwLb4o&Fo4yn4rF37Xo#1% zJgh@SNIY0Nc8Q1C^sv<$9+`9@!bu$|VY0^Eb~~9*rE?+J6``(@&UlB8FhVNW1`DbX z=*`;0Su>Y&8J$I5Dmls-$6k>@_jpC0;PHmM9`vQ2o)P*eO!ik)XI_DGSx1vV2UXN zu%%kU9dN2NAF*II)&9%0$)<`RC#Jv zYv_1dMtdM5MkKI;j&W(@5ZidbNahLA5qw$4v$7Z%%UTXs4&yl;Uy=CzOgteAFX;HH z9HW7_9ABdJf{GW*U{wIQA#WuUW;TRxFh#A;Y#1@p4Xm(bFkTI(1fNs*mX2@ZC0-$n zOvX%eOfBLmIHlU2EvEfl7PcX7WQ{m)4rWdh8!wBE?<;7YhB$9*OEiC|<3~b?kYksK zrr`{Js^TXKE~+ekx9xPup}uiX+{{Rq>-d>~Fw2Fr&*5dRpCJ*Bv!ecsiW+qGOek^8 zPsvQW*Ai;+WGroZjO9j<1aNnJa#f2|ZCB8dlBMpOj)>e;sH}AIf1JJ?+c7vPd?q`6 zah1g>Ia0OMsbaSx4X)2{Q|>Y{?)^)}->O;cUL(o*K0BX{o6>)rkd-&xl>#m+*_q~~ zY)=}woXLZtw%g1(U8Y?2a=3(tNDXhyHSozDi*G(TpWG);7C!wvVKmfIPUqLv+*kOl zEn-G&9J8LmoD;5agugXzg7+5_0H5G92q>-6! zJlE3iI{IHa+rO zm(_#K5r*Zdr$t?j1S4vddL|O2UWV#LWMegTiE%isq2@?P6lKS=I2NnlJC560!_ASf zY(>IF?2k1?0ueP58pj<4ylWEUeYlu7ZemrhXK6aIlsB&xh~i4#=GLNzSIAz(u$4EU zKHfrZ#3-*Tx8o+<$JO^^J08X@cnmu@KzHIKZpCvL#A(j{mtnFshwv&!@K0Fy4{tcH zBdLUuQtEhnS%TZ#dJdIp=GAir{)>C?ZdPceo)$e^1V)r{x#No;PM_YqM9FgzR{$s6b&FT9vIWc?wYa%YK&G+Q_3@b?|4!=2o@i*0u|JLVo%^ImKrR{g|p z2N6sVyc5>%c{GPqs&xl{+TbR{r^4>bh zv_Ei7&b$Dt|0n7mbKm~Vx4+QeFaqbOTB|})@mKdJtKy*hb6CX@MNxor90+eLAsL(_ pxr0+}h|x2hD$WL((%+y;XV6{W|34x5ST_Iw literal 0 HcmV?d00001 diff --git a/bin/module-info.class b/bin/module-info.class new file mode 100644 index 0000000000000000000000000000000000000000..596cfab338abc1d5859effc1a05318a68c28cafb GIT binary patch literal 179 zcmX^0Z`VEs1_oOO9(D#MMh5QO{FKt1RNc(Hw0uSeuHgLAqU2P!%$!t41_2}~y{yEt zL`DWSU$AOn26mvdZ)JF9UP^v>u~TVgPD*N#Faswe0}n`{UP@|lc1eDLFatLu11DG{ qDX}=Ufq{V$Xf*^dF)#xeObjdxtUy|ZfekFo#J~Zjxf;L}ga81$+$9$P literal 0 HcmV?d00001 diff --git a/src/Package/MyAplication.java b/src/Package/MyAplication.java new file mode 100644 index 0000000..8233000 --- /dev/null +++ b/src/Package/MyAplication.java @@ -0,0 +1,156 @@ +package Package; +import java.awt.EventQueue;import java.awt.FontMetrics; +import java.awt.Graphics; + +import javax.swing.JFrame; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JMenu; +import javax.swing.JButton; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; + +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.JProgressBar; +import javax.swing.JSplitPane; +import javax.swing.JLabel; +import java.awt.GridLayout; +import java.awt.Image; +import java.awt.Rectangle; +import java.awt.Shape; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.ImageObserver; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.AttributedCharacterIterator; + +import javax.swing.JPanel; +import javax.swing.SwingConstants; + +public class MyAplication { + + private JFrame frame; + private JTextField textField; + private JTextField textField_1; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + MyAplication window = new MyAplication(); + window.frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the application. + */ + public MyAplication() { + initialize(); + } + + /** + * Initialize the contents of the frame. + */ + private void initialize() { + frame = new JFrame(); + frame.setBounds(100, 100, 450, 300); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JMenuBar menuBar = new JMenuBar(); + frame.setJMenuBar(menuBar); + + JMenu mnNewMenu = new JMenu("New menu"); + menuBar.add(mnNewMenu); + frame.getContentPane().setLayout(new GridLayout(0, 1, 0, 0)); + + JPanel panel = new JPanel(); + frame.getContentPane().add(panel); + + JSplitPane splitPane_1 = new JSplitPane(); + panel.add(splitPane_1); + + JLabel f1 = new JLabel("Fichero 1"); + splitPane_1.setLeftComponent(f1); + + textField = new JTextField(); + splitPane_1.setRightComponent(textField); + textField.setColumns(10); + + JSplitPane splitPane = new JSplitPane(); + panel.add(splitPane); + + JLabel f2 = new JLabel("Fichero 2"); + splitPane.setLeftComponent(f2); + + textField_1 = new JTextField(); + splitPane.setRightComponent(textField_1); + + JProgressBar progressBar = new JProgressBar(0,100); + panel.add(progressBar); + textField_1.setColumns(10); + + JButton btnNewButton = new JButton("COPY!"); + panel.add(btnNewButton); + + btnNewButton.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + // TODO Auto-generated method stub + copy(f1.getText(),f2.getText(), progressBar); + + } + }); + + + + } + + private void copy(String f1, String f2, JProgressBar progressBar) { + File input=new File(textField.getText()); + File output=new File(textField_1.getText()); + + try { + FileInputStream in = new FileInputStream(textField.getText()); + FileOutputStream out = new FileOutputStream(textField_1.getText()); + + int n=0,c,total = progressBar.getMinimum(); + + System.out.print ("\nCopiando ..."); + while( (c = in.read()) != -1){ + progressBar.setValue(total++); + out.write(c); + n++; + + + } + in.close(); + out.close(); + System.out.print ("\nSe han copiado "+n+" caracteres\n"); + + } catch (FileNotFoundException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + +} diff --git a/src/module-info.java b/src/module-info.java new file mode 100644 index 0000000..9482edb --- /dev/null +++ b/src/module-info.java @@ -0,0 +1,10 @@ +/** + * + */ +/** + * @author Ivan + * + */ +module MyWindowsBuilder { + requires java.desktop; +} \ No newline at end of file