// Inicio FunciĆ³n Guardar void Guardar() { if (RutaOpen != null) { Archivo guardar = new Archivo(); String txta = textArea.getText(); RutaOpen = guardar.GuardaArchivo(txta, fc, RutaOpen); } else { GuardarComo(); } }
// inicio Impresion void imprimir() { int nlinea = 1; String lst = ""; for (int i = 0; i < lista.size(); i++, nlinea++) { System.out.println("\n*Linea " + nlinea); lst += lista.get(i).imprimirVector(nlinea) + "\n"; } System.out.println("\n\n" + lst); Archivo guardar = new Archivo(); RutaOpen = guardar.GuardaArchivo(lst, fc, "Prueba.lst"); }
// Inicio Funcion GuardarComo void GuardarComo() { fc.setDialogTitle("Guardar Archivo"); int returnVal = fc.showSaveDialog(Frame.this); if (returnVal == JFileChooser.APPROVE_OPTION) { String txta = textArea.getText(); Archivo gcomo = new Archivo(); RutaOpen = gcomo.GuardaArchivo(txta, fc, RutaOpen); } else { JOptionPane.showMessageDialog(null, "Cancelado"); } }
void manejo(String gtext) { String cadena = ""; String combo[] = null; // ETQ+INST+OPER+TYPE String CAL = "0000"; String CL = "00"; String TBS = ""; int scl = 0; String ETQ = ""; String INS = ""; String OPE = ""; String DIR = ""; String ACU = ""; String COL = ""; String COB = ""; StringTokenizer cutxt = new StringTokenizer(gtext, "\n"); while (cutxt.hasMoreTokens()) { Cadenatxt analizador = new Cadenatxt(); cadena = analizador.DeleteComment(cutxt.nextToken()); // Quitar Comentario Si es que lo trae. combo = analizador.Cortador(cadena, CAL); int cln = 0; int cl = 0; ETQ = ""; INS = ""; OPE = ""; DIR = ""; ACU = ""; COL = ""; COB = ""; Acu = Dirr; if (combo[1].compareTo("ORG") == 0) { // System.out.println("ETQ "+combo[0]+"\t\t INST "+combo[1]+"\t\tOPER "+combo[2]+"\t\tDIR // "+combo[3]+"\t\tACU "+combo[4]+"\t CL "+combo[5]+"CB "+combo[6]); System.out.println( combo[5] + "\t\t " + combo[4] + "\t\t " + combo[0] + "\t\t " + combo[1] + "\t\t " + combo[2]); while (combo[5].length() < 4) { combo[5] = "0" + combo[5]; } CL = combo[5]; ETQ = combo[0]; INS = combo[1]; OPE = combo[2]; DIR = combo[3]; ACU = combo[4]; COL = combo[5]; COB = combo[6]; } else if (combo[1].compareTo("EQU") == 0) { // System.out.println("ETQ "+combo[0]+"\t\t INST "+combo[1]+"\t\tOPER "+combo[2]+"\t\tDIR // "+combo[3]+"\t\tACU "+combo[4]+"\t CL "+combo[5]+"CB "+combo[6]); System.out.println( combo[5] + "\t\t " + combo[4] + "\t\t " + combo[0] + "\t\t " + combo[1] + "\t\t " + combo[2]); while (combo[5].length() < 4) { combo[5] = "0" + combo[5]; } TBS += combo[0] + "\t" + combo[5] + "\n"; ETQ = combo[0]; INS = combo[1]; OPE = combo[2]; DIR = combo[3]; ACU = combo[4]; COL = combo[5]; COB = combo[6]; } else if (combo[1].length() != 0) { // System.out.println("ETQ "+combo[0]+"\t\t INST "+combo[1]+"\t\tOPER "+combo[2]+"\t\tDIR // "+combo[3]+"\t\tACU "+combo[4]+"\t CL "+CL+" CB "+combo[6]); System.out.println( CL + "\t\t " + combo[4] + "\t\t " + combo[0] + "\t\t " + combo[1] + "\t\t " + combo[2]); if (combo[0].length() > 0 && combo[1].compareTo("EQU") != 0) { while (CL.length() < 4) { CL = "0" + CL; } TBS += combo[0] + "\t" + CL + "\n"; } ETQ = combo[0]; INS = combo[1]; OPE = combo[2]; DIR = combo[3]; ACU = combo[4]; COL = CL; COB = combo[6]; cl = Integer.parseInt(combo[5], 16); cln = Integer.parseInt(CL, 16); scl = cl + cln; CL = Integer.toString(scl, 16); while (CL.length() < 4) { CL = "0" + CL; } } agregarZapatos(ETQ, INS, OPE, DIR, ACU, COL, COB); } System.out.println("\n\n\tTBS \n" + TBS); Archivo lstx = new Archivo(); lstx.GuardaArchivo(TBS, fc, "Prueba.tbs"); imprimir(); }