Advertisement
Guest User

Untitled

a guest
Aug 6th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.87 KB | None | 0 0
  1. package com.csi.contadoralumnos.application
  2.  
  3. import scala.swing._
  4. import javax.swing.filechooser.FileNameExtensionFilter
  5.  
  6.  
  7. object contadorAlumnos extends Application {
  8.    
  9.     val frm = new FileChooser
  10.     frm.fileFilter = new FileNameExtensionFilter("Archivo Excel", "xlsx")
  11.     frm.showDialog(null, "Seleccione Archivo")
  12.  
  13.     var filePath = ""
  14.    
  15.     try {
  16.         filePath = frm.selectedFile.toString
  17.     } catch {
  18.         case npe: NullPointerException => exit  // esperado al presionar cancelar.                     
  19.         case e: Exception => e.printStackTrace //no esperado, imprime exception.
  20.     }        
  21.                                    
  22.     if (!filePath.endsWith("xlsx")) {
  23.         Dialog.showMessage(null, "Archivo no valido.", "Error", Dialog.Message.Error)
  24.         exit
  25.     }    
  26.        
  27.     def csiExcel = new CSIExcel(filePath)      
  28.     csiExcel.process
  29.    
  30.     Dialog.showMessage(null, "Procesamiento Terminado.", "Fin", Dialog.Message.Info)
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement