public void insertImage(String identification, int i) {
   try {
     files.extractZip(identification);
     ((TTAirButton) buttons.get(i)).setImage(converterTB.conversion(identification, files));
     ((TTAirButton) buttons.get(i)).setInsertedPicture(true);
   } catch (Exception erro) {
     System.out.println("error: Insert Image");
   }
 }
示例#2
0
  /**
   * Reads the previous learned RB from a input file
   *
   * @param fichero String The name of the file containing the learned RB
   */
  public void leer_BR(String fichero) {
    int i, j;
    String cadena;

    cadena = MyFile.ReadMyFile(fichero);

    StringTokenizer sT = new StringTokenizer(cadena, "\n\r\t ", false);
    sT.nextToken();
    sT.nextToken();
    sT.nextToken();

    n_reglas = Integer.parseInt(sT.nextToken());

    BaseReglas = new Rule[n_reglas];
    for (i = 0; i < n_reglas; i++) {
      BaseReglas[i] = new Rule(tabla.n_inputs, tabla.nClasses);
    }

    for (i = 0; i < n_reglas; i++) {
      for (j = 0; j < tabla.n_inputs; j++) {
        BaseReglas[i].Ant[j].Etiqueta = sT.nextToken();
        BaseReglas[i].Ant[j].x0 = Double.parseDouble(sT.nextToken());
        BaseReglas[i].Ant[j].x1 = Double.parseDouble(sT.nextToken());
        BaseReglas[i].Ant[j].x2 = BaseReglas[i].Ant[j].x1;
        BaseReglas[i].Ant[j].x3 = Double.parseDouble(sT.nextToken());
        BaseReglas[i].Ant[j].y = 1.0;
      }

      switch (tipo_reglas) {
        case 1:
          sT.nextToken();
          BaseReglas[i].Cons[0].clase = Integer.parseInt(sT.nextToken());
          break;
        case 2:
          sT.nextToken();
          BaseReglas[i].Cons[0].clase = Integer.parseInt(sT.nextToken());
          sT.nextToken();
          BaseReglas[i].Cons[0].gcerteza = Double.parseDouble(sT.nextToken());
          break;
        case 3:
          for (j = 0; j < tabla.nClasses; j++) {
            sT.nextToken();
            BaseReglas[i].Cons[j].clase = Integer.parseInt(sT.nextToken());
            sT.nextToken();
            BaseReglas[i].Cons[j].gcerteza = Double.parseDouble(sT.nextToken());
          }
      }
    }
  }
 public ManagerButton(MyscreenPanel msp) {
   if (!files.directoryExists()) {
     files.createDirectory();
   }
   this.msp = msp;
 }