Back to index

wims  3.65+svn20090927
d.java
Go to the documentation of this file.
00001 package atp;
00002 
00003 import java.applet.Applet;
00004 import java.awt.*;
00005 import java.awt.image.*;
00006 import java.io.*;
00007 import java.net.URL;
00008 import java.util.Hashtable;
00009 import java.util.StringTokenizer;
00010 
00011 // Referenced classes of package atp:
00012 //            a
00013 
00014 class d
00015 {
00016 
00017     private ImageProducer _flddo[] = {
00018         null, null, null, null, null
00019     };
00020     private String _fldif[] = {
00021         "8", "10", "12", "14", "18"
00022     };
00023     private Hashtable _fldfor;
00024     private static boolean a = true;
00025 
00026     public d()
00027     {
00028         _fldfor = new Hashtable(189);
00029     }
00030 
00031     public Image a(boolean flag, boolean flag1, String s, Graphics g, Applet applet)
00032     {
00033         StringTokenizer stringtokenizer = new StringTokenizer(s, "/");
00034         String s1 = stringtokenizer.nextToken();
00035         s1 = stringtokenizer.nextToken().substring(5);
00036         String s2 = stringtokenizer.nextToken();
00037         int i = -1;
00038         boolean flag2 = true;
00039         while(flag2) 
00040         {
00041             if(_fldif[++i].equals(s1))
00042             {
00043                 flag2 = false;
00044             }
00045             if(i == 4)
00046             {
00047                 flag2 = false;
00048             }
00049         }
00050         if(_flddo[i] == null)
00051         {
00052             _flddo[i] = a(flag, flag1, "Fonts" + s1 + ".gif", applet);
00053             String s3 = "Des" + s1 + ".gif";
00054             BufferedInputStream bufferedinputstream = null;
00055             try
00056             {
00057                 if(a)
00058                 {
00059                     InputStream inputstream = getClass().getResourceAsStream(s3);
00060                     bufferedinputstream = new BufferedInputStream(getClass().getResourceAsStream(s3));
00061                 } else
00062                 if((!flag) & (!flag1))
00063                 {
00064                     bufferedinputstream = new BufferedInputStream((new URL(s3)).openStream());
00065                 } else
00066                 if(flag)
00067                 {
00068                     bufferedinputstream = new BufferedInputStream((new URL(applet.getCodeBase(), s3)).openStream());
00069                 } else
00070                 {
00071                     try
00072                     {
00073                         bufferedinputstream = new BufferedInputStream(getClass().getResource(s3).openStream());
00074                     }
00075                     catch(Exception exception) { }
00076                 }
00077                 ObjectInputStream objectinputstream = new ObjectInputStream(bufferedinputstream);
00078                 int j = objectinputstream.readInt();
00079                 for(int k = 0; k < j; k++)
00080                 {
00081                     String s4 = (String)objectinputstream.readObject();
00082                     _fldfor.put(s1 + s4, new Rectangle((Rectangle)objectinputstream.readObject()));
00083                 }
00084 
00085                 bufferedinputstream.close();
00086             }
00087             catch(Exception exception1)
00088             {
00089                 //System.out.println(exception1.toString());
00090                 _flddo[i] = null;
00091             }
00092         }
00093         Image image = null;
00094         if(_flddo[i] != null)
00095         {
00096             Rectangle rectangle = (Rectangle)_fldfor.get(s1 + s2);
00097             image = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(new FilteredImageSource(_flddo[i], new CropImageFilter(rectangle.x, rectangle.y, rectangle.width, rectangle.height)), new a(g.getColor())));
00098         }
00099         return image;
00100     }
00101 
00102     public ImageProducer a(boolean flag, boolean flag1, String s, Applet applet)
00103     {
00104         ImageProducer imageproducer = null;
00105         if(a)
00106         {
00107             imageproducer = a(s);
00108         }
00109         if(imageproducer == null)
00110         {
00111             a = false;
00112             if((!flag) & (!flag1))
00113             {
00114                 imageproducer = Toolkit.getDefaultToolkit().getImage(s).getSource();
00115             } else
00116             if(flag)
00117             {
00118                 imageproducer = applet.getImage(applet.getCodeBase(), s).getSource();
00119             } else
00120             {
00121                 try
00122                 {
00123                     URL url = getClass().getResource(s);
00124                     imageproducer = (ImageProducer)url.getContent();
00125                 }
00126                 catch(Exception exception) { }
00127             }
00128         }
00129         return imageproducer;
00130     }
00131 
00132     ImageProducer a(String s)
00133     {
00134         ImageProducer imageproducer = null;
00135         try
00136         {
00137             InputStream inputstream = getClass().getResourceAsStream(s);
00138             int i = inputstream.available();
00139             byte abyte0[] = new byte[i];
00140             int j = 0;
00141             for(int k = 0; k != -1;)
00142             {
00143                 k = inputstream.read(abyte0, j, i);
00144                 if(k != -1)
00145                 {
00146                     j += k;
00147                     i = inputstream.available();
00148                     int l = j + i;
00149                     if(l > abyte0.length)
00150                     {
00151                         byte abyte1[] = (byte[])abyte0.clone();
00152                         abyte0 = new byte[l];
00153                         System.arraycopy(abyte1, 0, abyte0, 0, j);
00154                     }
00155                 }
00156                 if(i == 0)
00157                 {
00158                     break;
00159                 }
00160             }
00161 
00162             imageproducer = Toolkit.getDefaultToolkit().createImage(abyte0).getSource();
00163         }
00164         catch(Exception exception) { }
00165         return imageproducer;
00166     }
00167 
00168 }