Exemplo n.º 1
0
  public boolean prepareImage(FileSystem fs) throws Exception {
    boolean result = false;
    if (isImage()) {
      if (data == null || !(data instanceof Image)) {
        String fn = fileName.toLowerCase();
        if (fn.endsWith(".bmp")) {

          // Old edu.xtec.jclic.misc.Bmp replaced by image4j
          // Bmp bmp=new Bmp(fs.getInputStream(fileName));
          // setData(bmp.getImage());

          BufferedImage img = BMPDecoder.read(fs.getInputStream(fileName));
          setData(Toolkit.getDefaultToolkit().createImage(img.getSource()));
        } else if (fn.endsWith(".ico")) {
          java.util.List list = ICODecoder.read(fs.getInputStream(fileName));
          int maxs = 0;
          BufferedImage img = null;
          int listSize = list.size();
          for (int i = 0; i < listSize; i++) {
            BufferedImage imgtmp = (BufferedImage) list.get(i);
            int s = imgtmp.getWidth() * imgtmp.getHeight();
            if (s >= maxs) {
              img = imgtmp;
              maxs = s;
            }
          }
          if (img != null) setData(Toolkit.getDefaultToolkit().createImage(img.getSource()));
        } else setData(fs.getImageFile(fileName));
      }
      result = true;
    }
    return result;
  }
Exemplo n.º 2
0
 public static ProjectLibrary loadProjectLibrary(String fullPath, ResourceBridge rb)
     throws Exception {
   FileSystem fs = FileSystem.createFileSystem(fullPath, rb);
   org.jdom.Document doc = fs.getXMLDocument(FileSystem.getFileNameOf(fullPath));
   ProjectLibrary pl = new ProjectLibrary(rb, fs, fullPath);
   // pl.load(doc.getRootElement());
   pl.setProperties(doc.getRootElement(), null);
   return pl;
 }
Exemplo n.º 3
0
 /**
  * Setter for property name.
  *
  * @param name New value of property name.
  */
 public void setName(String name) {
   this.name = FileSystem.stdFn(name);
 }
Exemplo n.º 4
0
 public void setFileName(String sName) {
   fileName = FileSystem.stdFn(sName);
   data = null;
   animated = false;
 }