コード例 #1
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";
      }
    }
コード例 #2
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