|
@ -14,12 +14,12 @@ import javax.swing.JProgressBar; |
|
|
import javax.swing.JButton; |
|
|
import javax.swing.JButton; |
|
|
import javax.swing.JLabel; |
|
|
import javax.swing.JLabel; |
|
|
|
|
|
|
|
|
public class MyWindow implements ActionListener{ |
|
|
|
|
|
|
|
|
public class MyWindow{ |
|
|
|
|
|
|
|
|
private JFrame frame; |
|
|
private JFrame frame; |
|
|
private JTextField tfInput; |
|
|
|
|
|
private JTextField tfNewName; |
|
|
|
|
|
private JProgressBar pbCopy; |
|
|
|
|
|
|
|
|
private static JTextField tfInput; |
|
|
|
|
|
private static JTextField tfNewName; |
|
|
|
|
|
private static JProgressBar pbCopy; |
|
|
private static JButton btnCopy; |
|
|
private static JButton btnCopy; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -31,7 +31,12 @@ public class MyWindow implements ActionListener{ |
|
|
try { |
|
|
try { |
|
|
MyWindow window = new MyWindow(); |
|
|
MyWindow window = new MyWindow(); |
|
|
window.frame.setVisible(true); |
|
|
window.frame.setVisible(true); |
|
|
btnCopy.addActionListener(window); |
|
|
|
|
|
|
|
|
btnCopy.addActionListener(new ActionListener() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
copiarArch(); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
} |
|
|
} |
|
@ -76,17 +81,9 @@ public class MyWindow implements ActionListener{ |
|
|
JLabel lblNewLabel = new JLabel("Ruta del FIchero a copiar"); |
|
|
JLabel lblNewLabel = new JLabel("Ruta del FIchero a copiar"); |
|
|
lblNewLabel.setBounds(65, 21, 135, 14); |
|
|
lblNewLabel.setBounds(65, 21, 135, 14); |
|
|
frame.getContentPane().add(lblNewLabel); |
|
|
frame.getContentPane().add(lblNewLabel); |
|
|
} |
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
boolean copy = copiarArch(); |
|
|
|
|
|
if(copy) { |
|
|
|
|
|
//anything |
|
|
|
|
|
}else { |
|
|
|
|
|
//anything |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private boolean copiarArch() { |
|
|
|
|
|
|
|
|
private static boolean copiarArch() { |
|
|
String inputFile = tfInput.getText().toString(); |
|
|
String inputFile = tfInput.getText().toString(); |
|
|
String newName = tfNewName.getText().toString(); |
|
|
String newName = tfNewName.getText().toString(); |
|
|
String[]spliter = inputFile.split("[.]"); |
|
|
String[]spliter = inputFile.split("[.]"); |
|
|