Advertisement
Guest User

Untitled

a guest
Sep 27th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 24.02 KB | None | 0 0
  1.  
  2. import com.sun.corba.se.impl.oa.poa.ActiveObjectMap.Key;
  3. import com.sun.media.jai.codec.FileSeekableStream;
  4. import com.sun.media.jai.codec.ImageCodec;
  5. import com.sun.media.jai.codec.ImageDecoder;
  6. import com.sun.media.jai.codec.ImageEncoder;
  7. import com.sun.media.jai.codec.SeekableStream;
  8. import com.sun.media.jai.codec.TIFFEncodeParam;
  9. import java.awt.image.BufferedImage;
  10. import java.io.File;
  11. import java.io.FileOutputStream;
  12. import java.io.IOException;
  13. import java.io.OutputStream;
  14. import java.io.StringWriter;
  15. import java.io.Writer;
  16. import java.util.AbstractList;
  17. import java.util.ArrayList;
  18. import java.util.Collections;
  19. import java.util.HashMap;
  20. import java.util.List;
  21. import java.util.Map;
  22. import java.util.logging.Level;
  23. import java.util.logging.Logger;
  24. import javax.media.jai.NullOpImage;
  25. import javax.media.jai.OpImage;
  26. import javax.media.jai.PlanarImage;
  27. import javax.swing.JFileChooser;
  28. import javax.swing.JFrame;
  29. import javax.swing.JOptionPane;
  30. import javax.swing.filechooser.FileFilter;
  31. import javax.swing.filechooser.FileNameExtensionFilter;
  32. import javax.xml.transform.OutputKeys;
  33. import javax.xml.transform.Transformer;
  34. import javax.xml.transform.TransformerFactory;
  35. import javax.xml.transform.dom.DOMSource;
  36. import javax.xml.transform.stream.StreamResult;
  37. import org.w3c.dom.Node;
  38. import sun.awt.SunHints.Value;
  39.  
  40. /**
  41.  *
  42.  * @author ram
  43.  */
  44. public class MergeTifFile extends javax.swing.JFrame {
  45.  
  46.     String dir = "";
  47.     File dirr = null;
  48.  
  49.     String to = "";
  50.     File too = null;
  51.  
  52.     String sym = "";
  53.     HashMap<String, ArrayList<File>> fileList = new HashMap<>();
  54.  
  55.     private static FileFilterName tifName = new FileFilterName(".tif");
  56.  
  57.     // Her sætter jeg radiobutton og textboxs til at være true og false fra start.
  58.    
  59.     public MergeTifFile() {
  60.         initComponents();
  61.         rbtFolder.setSelected(true);
  62.         txtSymbol.setEnabled(false);
  63.         buttonGroup1.add(rbtFolder);
  64.         buttonGroup1.add(rbtFile);
  65.     }
  66.  
  67.     @SuppressWarnings("unchecked")
  68.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  69.     private void initComponents() {
  70.  
  71.         buttonGroup1 = new javax.swing.ButtonGroup();
  72.         btnStart = new javax.swing.JButton();
  73.         jLabel1 = new javax.swing.JLabel();
  74.         jLabel2 = new javax.swing.JLabel();
  75.         txtFromFolder = new javax.swing.JTextField();
  76.         txtSaveTo = new javax.swing.JTextField();
  77.         btnFrom = new javax.swing.JButton();
  78.         btnTo = new javax.swing.JButton();
  79.         rbtFolder = new javax.swing.JRadioButton();
  80.         rbtFile = new javax.swing.JRadioButton();
  81.         jLabel3 = new javax.swing.JLabel();
  82.         txtSymbol = new javax.swing.JTextField();
  83.         jLabel4 = new javax.swing.JLabel();
  84.         jLabel5 = new javax.swing.JLabel();
  85.  
  86.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  87.  
  88.         btnStart.setText("Start");
  89.         btnStart.addActionListener(new java.awt.event.ActionListener() {
  90.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  91.                 btnStartActionPerformed(evt);
  92.             }
  93.         });
  94.  
  95.         jLabel1.setText("From Folder:");
  96.  
  97.         jLabel2.setText("To Folder:");
  98.  
  99.         txtFromFolder.setEnabled(false);
  100.         txtFromFolder.addActionListener(new java.awt.event.ActionListener() {
  101.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  102.                 txtFromFolderActionPerformed(evt);
  103.             }
  104.         });
  105.  
  106.         txtSaveTo.setEnabled(false);
  107.         txtSaveTo.addActionListener(new java.awt.event.ActionListener() {
  108.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  109.                 txtSaveToActionPerformed(evt);
  110.             }
  111.         });
  112.  
  113.         btnFrom.setText("Browser");
  114.         btnFrom.addActionListener(new java.awt.event.ActionListener() {
  115.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  116.                 btnFromActionPerformed(evt);
  117.             }
  118.         });
  119.  
  120.         btnTo.setText("Browser");
  121.         btnTo.addActionListener(new java.awt.event.ActionListener() {
  122.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  123.                 btnToActionPerformed(evt);
  124.             }
  125.         });
  126.  
  127.         rbtFolder.setText("Folder");
  128.         rbtFolder.addActionListener(new java.awt.event.ActionListener() {
  129.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  130.                 rbtFolderActionPerformed(evt);
  131.             }
  132.         });
  133.  
  134.         rbtFile.setText("File");
  135.         rbtFile.addActionListener(new java.awt.event.ActionListener() {
  136.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  137.                 rbtFileActionPerformed(evt);
  138.             }
  139.         });
  140.  
  141.         jLabel3.setText("Split after:");
  142.  
  143.         txtSymbol.setText("-");
  144.  
  145.         jLabel4.setText("fx. /, \\, +, -, _ ");
  146.  
  147.         jLabel5.setText("if \".\"     Enter \\\\.    ");
  148.  
  149.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  150.         getContentPane().setLayout(layout);
  151.         layout.setHorizontalGroup(
  152.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  153.             .addGroup(layout.createSequentialGroup()
  154.                 .addContainerGap()
  155.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  156.                     .addGroup(layout.createSequentialGroup()
  157.                         .addComponent(jLabel3)
  158.                         .addGap(30, 30, 30)
  159.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  160.                             .addComponent(txtSymbol, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
  161.                             .addComponent(jLabel5)
  162.                             .addComponent(jLabel4)))
  163.                     .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  164.                         .addComponent(btnStart, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
  165.                         .addGroup(layout.createSequentialGroup()
  166.                             .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
  167.                                 .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  168.                                 .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING))
  169.                             .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  170.                                 .addGroup(layout.createSequentialGroup()
  171.                                     .addGap(18, 18, 18)
  172.                                     .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  173.                                         .addComponent(rbtFolder)
  174.                                         .addComponent(rbtFile)))
  175.                                 .addGroup(layout.createSequentialGroup()
  176.                                     .addGap(20, 20, 20)
  177.                                     .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  178.                                         .addComponent(txtFromFolder, javax.swing.GroupLayout.PREFERRED_SIZE, 352, javax.swing.GroupLayout.PREFERRED_SIZE)
  179.                                         .addComponent(txtSaveTo, javax.swing.GroupLayout.PREFERRED_SIZE, 352, javax.swing.GroupLayout.PREFERRED_SIZE))))
  180.                             .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  181.                             .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  182.                                 .addComponent(btnFrom)
  183.                                 .addComponent(btnTo)))))
  184.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  185.         );
  186.         layout.setVerticalGroup(
  187.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  188.             .addGroup(layout.createSequentialGroup()
  189.                 .addGap(17, 17, 17)
  190.                 .addComponent(rbtFolder)
  191.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  192.                 .addComponent(rbtFile)
  193.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  194.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  195.                     .addComponent(jLabel1)
  196.                     .addComponent(txtFromFolder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  197.                     .addComponent(btnFrom))
  198.                 .addGap(35, 35, 35)
  199.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  200.                     .addComponent(jLabel2)
  201.                     .addComponent(txtSaveTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  202.                     .addComponent(btnTo))
  203.                 .addGap(18, 18, 18)
  204.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  205.                     .addComponent(jLabel3)
  206.                     .addComponent(txtSymbol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  207.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  208.                 .addComponent(jLabel4)
  209.                 .addGap(3, 3, 3)
  210.                 .addComponent(jLabel5)
  211.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  212.                 .addComponent(btnStart)
  213.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  214.         );
  215.  
  216.         pack();
  217.     }// </editor-fold>                        
  218.  
  219.     private void btnStartActionPerformed(java.awt.event.ActionEvent evt) {                                        
  220.         //Hvis fra og til text boxs er tomme, så udføre ikke dette.    
  221.         if (txtFromFolder.getText().isEmpty() && txtSaveTo.getText().isEmpty()) {
  222.                 JOptionPane.showMessageDialog(null, "Try again.", "Fail", JOptionPane.INFORMATION_MESSAGE);
  223.             }
  224.             else
  225.             {
  226.                 try
  227.                 {
  228.                     //indsætter ekstra \ hvis der står et i forvejen.
  229.                     dir = txtFromFolder.getText();
  230.                     dir = dir.replace("\\", "\\\\");
  231.                     System.out.println(dir);
  232.                     dirr = new File(dir);
  233.                 }
  234.                 catch (Exception e)
  235.                 {
  236.                     // Hvis ingen mapper findes.
  237.                     JOptionPane.showMessageDialog(null, "No folder found, try again.", "Fail.", JOptionPane.INFORMATION_MESSAGE);
  238.                 }
  239.  
  240.                 try
  241.                 {
  242.                     //indsætter ekstra \ hvis der står et i forvejen.
  243.                     to = txtSaveTo.getText();
  244.                     to = to.replace("\\", "\\\\");
  245.                     System.out.println(to);
  246.                     too = new File(to);
  247.                 }
  248.                 catch (Exception e)
  249.                 {
  250.                     // Hvis ingen mapper findes.
  251.                     JOptionPane.showMessageDialog(null, "Cannot save this file.", "Fail.", JOptionPane.INFORMATION_MESSAGE);
  252.                     txtSaveTo.setText("");
  253.                 }
  254.                 try
  255.                 {
  256.                     sym = txtSymbol.getText();
  257.                 }
  258.                 catch(Exception e)
  259.                         {
  260.                             JOptionPane.showMessageDialog(null, "Enter in spilt box.", "Fail.", JOptionPane.INFORMATION_MESSAGE);
  261.                         }
  262.  
  263.                 if (txtFromFolder.getText() == null && txtSaveTo.getText() == null)
  264.                 {
  265.                     System.err.println("Udfylde begge felter! Og prøv igen.");
  266.                 }
  267.                 else
  268.                 {
  269.                     if (rbtFolder.isSelected())
  270.                     {
  271.                         if(txtSymbol.getText() != null)
  272.                         {
  273.                                                     try
  274.                         {
  275.                             findFiles1(dirr);
  276.                             merg();
  277.                         }
  278.                         catch (Exception ex)
  279.                         {
  280.                             Logger.getLogger(MergeTifFile.class.getName()).log(Level.SEVERE, null, ex);
  281.                         }
  282.                         }
  283.                         else
  284.                         {
  285.                                 JOptionPane.showMessageDialog(null, "Enter Symbol in .....!", "Fail", JOptionPane.INFORMATION_MESSAGE);
  286.                         }
  287.  
  288.                     }
  289.                     else
  290.                     {
  291.                         try
  292.                         {
  293.                             findFiles1(dirr);
  294.                         }
  295.                         catch (Exception ex)
  296.                         {
  297.                             Logger.getLogger(MergeTifFile.class.getName()).log(Level.SEVERE, null, ex);
  298.                         }
  299.                     }
  300.                 }
  301.             }
  302.     }                                        
  303.  
  304.     private void rbtFolderActionPerformed(java.awt.event.ActionEvent evt) {                                          
  305.         //Hvis folder radiobutton er valget, så skal man ikke kunne skrive i txtSymbol.
  306.         if (rbtFolder.isSelected()) {
  307. //            JOptionPane.showMessageDialog(null, "You have selected Folder program.", "Folder", JOptionPane.INFORMATION_MESSAGE);
  308.              txtSymbol.setEnabled(false);
  309.         }
  310.     }                                        
  311.  
  312.     private void btnFromActionPerformed(java.awt.event.ActionEvent evt) {                                        
  313.        //Her fra vælger man hvilket mappe man ønsker at hente tif filer flere.
  314.         FileFilter filter = new FileNameExtensionFilter("Tif File","tif");
  315.         JFileChooser folderChooser = new JFileChooser();
  316.         folderChooser.setCurrentDirectory(new java.io.File("."));
  317.         folderChooser.addChoosableFileFilter(filter);
  318.         folderChooser.setDialogTitle("Find folder");
  319.         folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  320.         folderChooser.setAcceptAllFileFilterUsed(false);
  321.         folderChooser.showOpenDialog(null);
  322.         File f = folderChooser.getSelectedFile();
  323.         String folderName = f.getAbsolutePath();
  324.         txtFromFolder.setText(folderName);
  325.         System.out.println("Load from folder: " + dirr);
  326.     }                                      
  327.  
  328.     private void btnToActionPerformed(java.awt.event.ActionEvent evt) {                                      
  329.         //Her til vælger man hvor den nye tif fil(er) skal lægges.
  330.         JFrame parentFrame = new JFrame();
  331.         JFileChooser fileChooser = new JFileChooser();
  332.         fileChooser.setDialogTitle("Save file to...");
  333.         fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  334.         int userSelection = fileChooser.showSaveDialog(parentFrame);
  335.         if (userSelection == JFileChooser.APPROVE_OPTION) {
  336.             File fileToSave = fileChooser.getSelectedFile();
  337.             String folderName = fileToSave.getAbsolutePath();
  338.             txtSaveTo.setText(folderName);
  339.             System.out.println("Save in folder: " + too);
  340.         }
  341.     }                                    
  342.  
  343.     private void rbtFileActionPerformed(java.awt.event.ActionEvent evt) {                                        
  344.        //Vælger man rediobutton for filer, så skal man også skrive i txtSymbol, hvor filen skal splittes.
  345.         if (rbtFile.isSelected())
  346.         {
  347.             if(txtSymbol.getText() != null || txtSymbol.getText() != "")
  348.             {
  349.                             try
  350.             {
  351. //                JOptionPane.showMessageDialog(null, "You have selected File program.", "File", JOptionPane.INFORMATION_MESSAGE);
  352.                  txtSymbol.setEnabled(true);
  353.             }
  354.             catch (Exception ex)
  355.             {
  356.                 Logger.getLogger(MergeTifFile.class.getName()).log(Level.SEVERE, null, ex);
  357.             }
  358.             }
  359.             else
  360.             {
  361.                 System.out.println("Enter Symbol in textbox. And try again.");
  362.             }
  363.         }
  364.     }                                      
  365.  
  366.     private void txtFromFolderActionPerformed(java.awt.event.ActionEvent evt) {                                              
  367.         // TODO add your handling code here:
  368.     }                                            
  369.  
  370.     private void txtSaveToActionPerformed(java.awt.event.ActionEvent evt) {                                          
  371.         // TODO add your handling code here:
  372.     }                                        
  373.     //Her bliver der sorteret ud fra filtype og så bliver filen også smidt ind i en hashmap, hvis den ikke findes ellers lagt til en arrayList.
  374.     public void findFiles1(File dir) throws IOException, Exception {
  375.  
  376.         File[] listOfFolder = dir.listFiles();
  377.         //Folder
  378.         for (File file : listOfFolder) {
  379.             if (file.isDirectory()) {
  380.                 findFiles1(file);
  381.             } else
  382.             {
  383.                 if (tifName.accept(dir, file.getName()))
  384.                 {
  385.                     if (file.getName().endsWith(".tiff") || file.getName().endsWith(".tif"))
  386.                     {
  387.  
  388.                             String key = file.getName().split(sym)[0];
  389.                            if (fileList.containsKey(key)) {
  390.                             fileList.get(key).add(file);
  391.                             System.out.println("Old file found: " + file.getName().split(sym)[0] + " is old: " + fileList.get(key).add(file) + file.getAbsolutePath());
  392. //                             List mapValues =  ArrayList(fileList.values());                    
  393.                              Collections.sort(fileList.get(key));
  394.                         }
  395.                          else
  396.                         {
  397.                             fileList.put(key, new ArrayList<File>());
  398.                             fileList.get(key).add(file);
  399.                             System.out.println("New file found: " + file.getName().split(sym)[0] + " is new: " + fileList.get(key).add(file));
  400.                             System.out.println("Put new file i arrayList: " + fileList.put(key, new ArrayList<File>()));
  401.                             System.out.println("File name: " + file.getName() + " and file location " + file.getAbsolutePath());
  402.                             String fil = file.getAbsolutePath();
  403.                         }
  404. //                      }
  405.                        
  406.  
  407.                         List mapKeys = new ArrayList(fileList.keySet());
  408.                         Collections.sort(mapKeys);
  409.                        
  410.                     }                    
  411.                 }
  412.                 else
  413.                 {
  414.                     System.err.println("This file : " + file.getName() + " not tif file.");
  415.                 }
  416.  
  417.             }
  418.         }
  419.         System.err.println("Done");
  420.     }
  421.  
  422.     //Her sker alt samling af tif filer, ud fra den liste man får fra hashmappen.
  423.     public void merg() throws IOException
  424.     {      
  425.         String [] tifs = {};
  426.        
  427.        
  428.         int numTifs = tifs.length;  // 2 or many pages
  429.  
  430.         BufferedImage image[] = new BufferedImage[numTifs];
  431.         for (int i = 0; i < numTifs; i++)
  432.         {
  433. //            SeekableStream ss = new FileSeekableStream(tifs[i]);
  434.             try (SeekableStream ss = new FileSeekableStream(tifs[i])) {
  435.                 //            SeekableStream ss = new FileSeekableStream(tifs[i]);
  436.                 ImageDecoder decoder = ImageCodec.createImageDecoder("tiff", ss, null);
  437.                 PlanarImage pi = new NullOpImage(decoder.decodeAsRenderedImage(0), null, null, OpImage.OP_IO_BOUND);
  438.                 image[i] = pi.getAsBufferedImage();
  439.             }
  440.         }
  441.  
  442.         TIFFEncodeParam params = new TIFFEncodeParam();
  443.         params.setCompression(TIFFEncodeParam.COMPRESSION_DEFLATE);
  444.         System.out.println("Output: " + too);
  445.         OutputStream out = new FileOutputStream(too + "\\" + "fff" + ".tif");
  446.         ImageEncoder encoder = ImageCodec.createImageEncoder("tiff", out, params);
  447.         List<BufferedImage> list = new ArrayList<BufferedImage>(image.length);
  448.         for (int i = 1; i < image.length; i++) {
  449.             list.add(image[i]);
  450.         }
  451.         params.setExtraImages(list.iterator());
  452.         encoder.encode(image[0]);
  453.         out.close();
  454.     }
  455.  
  456.     // Tjekker om det er et Int eller en String, og hvis det er en String, så vil den returne false ellers true.
  457.     public static boolean isNumeric(String str) {
  458.         try {
  459.             int i = Integer.parseInt(str);
  460.         } catch (NumberFormatException nfe) {
  461.             return false;
  462.         }
  463.         return true;
  464.     }
  465.  
  466.     /**
  467.      * @param args the command line arguments
  468.      */
  469.     public static void main(String args[]) {
  470.         /* Set the Nimbus look and feel */
  471.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  472.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  473.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  474.          */
  475.         try {
  476.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  477.                 if ("Nimbus".equals(info.getName())) {
  478.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  479.                     break;
  480.                 }
  481.             }
  482.         } catch (ClassNotFoundException ex) {
  483.             java.util.logging.Logger.getLogger(MergeTifFile.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  484.         } catch (InstantiationException ex) {
  485.             java.util.logging.Logger.getLogger(MergeTifFile.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  486.         } catch (IllegalAccessException ex) {
  487.             java.util.logging.Logger.getLogger(MergeTifFile.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  488.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  489.             java.util.logging.Logger.getLogger(MergeTifFile.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  490.         }
  491.         //</editor-fold>
  492.  
  493.         /* Create and display the form */
  494.         java.awt.EventQueue.invokeLater(new Runnable() {
  495.             public void run() {
  496.                 new MergeTifFile().setVisible(true);
  497.             }
  498.         });
  499.     }
  500.  
  501.     public static final void prettyPrint(Node xml) throws Exception {
  502.         Transformer tf = TransformerFactory.newInstance().newTransformer();
  503.         tf.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
  504.         tf.setOutputProperty(OutputKeys.INDENT, "yes");
  505.         Writer out = new StringWriter();
  506.         tf.transform(new DOMSource(xml), new StreamResult(out));
  507.         System.out.println(out.toString());
  508.     }
  509.  
  510.     // Variables declaration - do not modify                    
  511.     private javax.swing.JButton btnFrom;
  512.     private javax.swing.JButton btnStart;
  513.     private javax.swing.JButton btnTo;
  514.     private javax.swing.ButtonGroup buttonGroup1;
  515.     private javax.swing.JLabel jLabel1;
  516.     private javax.swing.JLabel jLabel2;
  517.     private javax.swing.JLabel jLabel3;
  518.     private javax.swing.JLabel jLabel4;
  519.     private javax.swing.JLabel jLabel5;
  520.     private javax.swing.JRadioButton rbtFile;
  521.     private javax.swing.JRadioButton rbtFolder;
  522.     private javax.swing.JTextField txtFromFolder;
  523.     private javax.swing.JTextField txtSaveTo;
  524.     private javax.swing.JTextField txtSymbol;
  525.     // End of variables declaration                  
  526.  
  527. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement