Ejemplo n.º 1
0
 public void ChangeCurrentPortrait() {
   try {
     TargaImage deftga = new TargaImage(new File(CURRENTPORTRAIT));
     CurrentPortrait.setIcon(new ImageIcon(deftga.getImage()));
   } catch (IOException e) {
     System.out.println("Invalid image: " + CURRENTPORTRAIT);
   }
 }
Ejemplo n.º 2
0
    private void PicButtonActionPerformed(ActionEvent evt) {
      OKButton.setEnabled(true);
      javax.swing.Icon test = PicButton.getIcon();
      if (test instanceof ImageIcon) {
        if (isBIFpic) {
          String BIFFILENAME = "po_" + tmpname + "l.tga";
          try {
            InfoText.setText(BIFFILENAME);

            File tempImage = RESFAC.TempImageFile(BIFFILENAME);
            if (tempImage != null) {
              TargaImage curtga = new TargaImage(tempImage);
              CurrentPortrait.setIcon(new ImageIcon(curtga.getImage()));
              BICPortraitname = "po_" + tmpname;
              CURRENTPORTRAIT = tempImage.getParent() + FileDelim + baseFilename;
              OKButton.setEnabled(true);
            }
          } catch (IOException err) {
            JOptionPane.showMessageDialog(
                null,
                "Fatal Error - " + BIFFILENAME + " not found. Your data files might be corrupt.",
                "Error",
                0);
            System.exit(0);
          }
        } else {
          String PORTRAIT = qualifiedName;
          if (qualifiedName.toUpperCase().endsWith("M.TGA")) {
            CURRENTPORTRAIT = PORTRAIT;
            PORTRAIT = qualifiedName.substring(0, qualifiedName.length() - 5) + "l.tga";
          }

          ImageIcon icon = null;
          try {
            icon = new ImageIcon(new TargaImage(new File(PORTRAIT)).getImage());
          } catch (IOException e) {
            System.out.println("Invalid Icon: " + PORTRAIT);
            icon = null;
          }

          CurrentPortrait.setIcon(icon);
          BICPortraitname = baseFilename.substring(0, baseFilename.length() - 4);
          InfoText.setText(PORTRAIT.substring(PORTRAIT.lastIndexOf(FileDelim) + 1));
          if (BICPortraitname.toLowerCase().endsWith("m")
              || BICPortraitname.toLowerCase().endsWith("l")
              || BICPortraitname.toLowerCase().endsWith("h")
              || BICPortraitname.toLowerCase().endsWith("s")
              || BICPortraitname.toLowerCase().endsWith("t")) {
            BICPortraitname = BICPortraitname.substring(0, BICPortraitname.length() - 1);
          }
          OKButton.setEnabled(true);
        }
      }
    }
Ejemplo n.º 3
0
    public Portrait(String dir, String imageFilename, boolean isBifpic, String pretmpname) {
      baseFilename = imageFilename;
      qualifiedName = dir + imageFilename;
      tmpname = pretmpname;
      isBIFpic = isBifpic;

      CreateButton();

      try {
        File targetfile = new File(qualifiedName);
        TargaImage tgapic = new TargaImage(targetfile);
        Dimension tgasize = tgapic.getSize();
        double tmpsize =
            (new Float(tgasize.height)).doubleValue() * (new Float(0.78125D)).doubleValue();
        tgapic.setHeight((int) tmpsize);
        PicButton.setIcon(new ImageIcon(tgapic.getImage()));
      } catch (IOException e) {
        System.out.println("Invalid image: " + qualifiedName);
        qualifiedName = "null";
      }
    }
Ejemplo n.º 4
0
  private void OKButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_OKButtonActionPerformed
    try {
      TargaImage deftg = new TargaImage(new File(CURRENTPORTRAIT));
      System.out.println("Filename according to the bic: " + BICPortraitname);
      Dimension tgasize = deftg.getSize();
      double tmpsize =
          (new Float(tgasize.height)).doubleValue() * (new Float(0.78125D)).doubleValue();
      deftg.setHeight((int) tmpsize);
      java.awt.Image tempportimage = deftg.getImage();
      menucreate.CharPortrait.setIcon(new ImageIcon(tempportimage));
      menucreate.MainCharData[2] = new HashMap();
      menucreate.MainCharData[2].put(new Integer(0), BICPortraitname);
      menucreate.BlockWindow(false);
      setVisible(false);
      dispose();

      // Add your handling code here:
      CreateMenu menucreate = TLKFactory.getCreateMenu();
      menucreate.ClassButton.setEnabled(true);
    } catch (IOException e) {
      System.out.println("Invalid Image: " + CURRENTPORTRAIT);
    }
  } // GEN-LAST:event_OKButtonActionPerformed