Back to index

wims  3.65+svn20090927
f.java
Go to the documentation of this file.
00001 package atp;
00002 
00003 import java.awt.*;
00004 import java.awt.image.*;
00005 import java.io.*;
00006 import java.util.Hashtable;
00007 import java.util.StringTokenizer;
00008 
00009 // Referenced classes of package atp:
00010 //            a
00011 
00012 class f
00013 {
00014 
00015     private ImageProducer _flddo[] = {
00016         null, null, null, null, null
00017     };
00018     private String _fldif[] = {
00019         "8", "10", "12", "14", "18"
00020     };
00021     private Hashtable _fldfor;
00022     private static boolean a = true;
00023 
00024     public f()
00025     {
00026         _fldfor = new Hashtable(189);
00027     }
00028 
00029     public Image a(String s, Graphics g)
00030     {
00031         StringTokenizer stringtokenizer = new StringTokenizer(s, "/");
00032         String s1 = stringtokenizer.nextToken();
00033         s1 = stringtokenizer.nextToken().substring(5);
00034         String s2 = stringtokenizer.nextToken();
00035         int i = -1;
00036         boolean flag2 = true;
00037         while(flag2) 
00038         {
00039             if(_fldif[++i].equals(s1))
00040             {
00041                 flag2 = false;
00042             }
00043             if(i == 4)
00044             {
00045                 flag2 = false;
00046             }
00047         }
00048         if(_flddo[i] == null)
00049         {
00050             _flddo[i] = a("Fonts" + s1 + ".gif");
00051             String s3 = "Des" + s1 + ".gif";
00052             BufferedInputStream bufferedinputstream = null;
00053             try
00054             {
00055                 InputStream inputstream = getClass().getResourceAsStream(s3);
00056                    bufferedinputstream = new BufferedInputStream(getClass().getResourceAsStream(s3));
00057                 ObjectInputStream objectinputstream = new ObjectInputStream(bufferedinputstream);
00058                 int j = objectinputstream.readInt();
00059                 for(int k = 0; k < j; k++)
00060                 {
00061                     String s4 = (String)objectinputstream.readObject();
00062                     _fldfor.put(s1 + s4, new Rectangle((Rectangle)objectinputstream.readObject()));
00063                 }
00064 
00065                 bufferedinputstream.close();
00066             }
00067             catch(Exception exception1)
00068             {
00069                 //System.out.println(exception1.toString());
00070                 _flddo[i] = null;
00071             }
00072         }
00073         Image image = null;
00074         if(_flddo[i] != null)
00075         {
00076             Rectangle rectangle = (Rectangle)_fldfor.get(s1 + s2);
00077             image = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(new FilteredImageSource(_flddo[i], new CropImageFilter(rectangle.x, rectangle.y, rectangle.width, rectangle.height)), new a(g.getColor())));
00078         }
00079         return image;
00080     }
00081 
00082     ImageProducer a (String s)
00083     {
00084         ImageProducer imageproducer = null;
00085         try
00086         {
00087             InputStream inputstream = getClass().getResourceAsStream(s);
00088             int i = inputstream.available();
00089             byte abyte0[] = new byte[i];
00090             int j = 0;
00091             for(int k = 0; k != -1;)
00092             {
00093                 k = inputstream.read(abyte0, j, i);
00094                 if(k != -1)
00095                 {
00096                     j += k;
00097                     i = inputstream.available();
00098                     int l = j + i;
00099                     if(l > abyte0.length)
00100                     {
00101                         byte abyte1[] = (byte[])abyte0.clone();
00102                         abyte0 = new byte[l];
00103                         System.arraycopy(abyte1, 0, abyte0, 0, j);
00104                     }
00105                 }
00106                 if(i == 0)
00107                 {
00108                     break;
00109                 }
00110             }
00111 
00112             imageproducer = Toolkit.getDefaultToolkit().createImage(abyte0).getSource();
00113         }
00114         catch(Exception exception) { }
00115         return imageproducer;
00116     }
00117 
00118 }