1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| import java.lang.*;
import javax.swing.*;
import java.awt.print.*;
import java.awt.image.*;
import java.io.File;
import java.io.*;
import java.text.*;
import java.awt.Graphics2D;
import javax.imageio.ImageIO;
import javax.print.*;
import javax.print.attribute.*;
import java.io.IOException;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.SAXParser;
/**
*
* @author roussel
*/
public class Escalier extends JInternalFrame {
ParsingC parseurC = new ParsingC ();
String nom_courbe = new String();
/** Creates new form Escalier */
public Escalier(String[] nom, Number[] actuel, Number[] diff, String nom_p,String nomA) {
this.setTitle(nom_p);
String[] contenu = new String[15];
initComponents();
jLabel28.setText(nom_p);
for (int i = 0; i<15; i++)
contenu[i]="";
for (int i =0; i<diff.length;i++)
{
if (diff[i].intValue()==0)
{
if (actuel[i].intValue()== 1) contenu[0]+= " "+nom[i]+"\n";
if (actuel[i].intValue()==2) contenu[1]+= " "+nom[i]+"\n";
if (actuel[i].intValue()==3) contenu[2]+= " "+nom[i]+"\n";
if(actuel[i].intValue()==4) contenu[3]+= " "+nom[i]+"\n";
if (actuel[i].intValue()==5) contenu[4]+= " "+nom[i]+"\n";
}
if (diff[i].intValue()==1)
{
if (actuel[i].intValue()==1) contenu[5]+= " "+nom[i]+"\n";
if (actuel[i].intValue()==2) contenu[6]+= " "+nom[i]+"\n";
if (actuel[i].intValue()==3) contenu[7]+= " "+nom[i]+"\n";
if(actuel[i].intValue()==4) contenu[8]+= " "+nom[i]+"\n";
}
if (diff[i].intValue()== 2)
{
if (actuel[i].intValue()==1) contenu[9] += " "+nom[i]+"\n";
if (actuel[i].intValue()==2) contenu[10] += " "+nom[i]+"\n";
if (actuel[i].intValue()==3) contenu[11] += " "+nom[i]+"\n";
}
if (diff[i].intValue()== 3)
{
if(actuel[i].intValue()==1) contenu[12] += " "+nom[i]+"\n";
if (actuel[i].intValue()==2) contenu[13] += " "+nom[i]+"\n";
}
if (diff[i].intValue()== 4)
{
if(actuel[i].intValue()==1) contenu[14] += " "+nom[i]+"\n";
}
}
jLabel23.setText(contenu[0]);
jLabel19.setText(contenu[1]);
jLabel16.setText(contenu[2]);
jLabel14.setText(contenu[3]);
jLabel13.setText(contenu[4]);
jLabel24.setText(contenu[5]);
jLabel20.setText(contenu[6]);
jLabel17.setText(contenu[7]);
jLabel15.setText(contenu[8]);
jLabel25.setText(contenu[9]);
jLabel21.setText(contenu[10]);
jLabel18.setText(contenu[11]);
jLabel26.setText(contenu[12]);
jLabel22.setText(contenu[13]);
jLabel27.setText(contenu[14]);
this.pack();
this.validate();
SAXParserFactory factoryC = SAXParserFactory.newInstance();
try {
SAXParser saxParserC = factoryC.newSAXParser();
saxParserC.parse("C:/Program Files/CityShare Assistant/config.xml",parseurC);
}catch (Throwable t){
t.printStackTrace();
}
BufferedImage bi = new BufferedImage(this.getWidth(),this.getHeight(),BufferedImage.TYPE_INT_RGB);
((JPanel)this.getContentPane()).paint(bi.getGraphics());
File file1 = new File(parseurC.liste()[1]+"/"+nomA+"/"+nom_p+".png");
nom_courbe = file1.getPath();
try {
ImageIO.write(bi, "png",file1);
} catch (IOException ex) {
ex.printStackTrace();
}
}
} |
Partager