Browse Source

My window maker

master
Ivan Morell 2 years ago
commit
badc436935
10 changed files with 209 additions and 0 deletions
  1. +10
    -0
      .classpath
  2. +17
    -0
      .project
  3. +2
    -0
      .settings/org.eclipse.core.resources.prefs
  4. +14
    -0
      .settings/org.eclipse.jdt.core.prefs
  5. BIN
      bin/Package/MyAplication$1.class
  6. BIN
      bin/Package/MyAplication$2.class
  7. BIN
      bin/Package/MyAplication.class
  8. BIN
      bin/module-info.class
  9. +156
    -0
      src/Package/MyAplication.java
  10. +10
    -0
      src/module-info.java

+ 10
- 0
.classpath View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

+ 17
- 0
.project View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MyWindowsBuilder</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

+ 2
- 0
.settings/org.eclipse.core.resources.prefs View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

+ 14
- 0
.settings/org.eclipse.jdt.core.prefs View File

@ -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

BIN
bin/Package/MyAplication$1.class View File


BIN
bin/Package/MyAplication$2.class View File


BIN
bin/Package/MyAplication.class View File


BIN
bin/module-info.class View File


+ 156
- 0
src/Package/MyAplication.java View File

@ -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();
}
}
}

+ 10
- 0
src/module-info.java View File

@ -0,0 +1,10 @@
/**
*
*/
/**
* @author Ivan
*
*/
module MyWindowsBuilder {
requires java.desktop;
}

Loading…
Cancel
Save