private static Applet applet;
    private static byte data[];
    private static final int R = 20;
    private static final int hx = 5;
    private static final int hy = 5;
    private static final int bgGrey = 250;
    private static int maxr;
    private int Rl;
    private int Gl;
    private int Bl;
    private Image balls; static void setApplet(Applet applet1)
    {
        applet = applet1;
    }
        Atom(int i, int j, int k)
    {
        Rl = i;
        Gl = j;
        Bl = k;
    }    
    private final int blend(int i, int j, float f)
    {
        return (int)((float)j + (float)(i - j) * f);
    }    void paint(Graphics g, int i, int j, int k)
    {
        Image image = balls;
        if(image == null)
        {
            Setup();
            image = balls;
        }
        g.drawImage(image, i- (k >> 1) , j - (k >> 1), k, k, applet);
    }    private void Setup()
    {
        byte abyte0[] = new byte[256];
        byte abyte1[] = new byte[256];
        byte abyte2[] = new byte[256];
        abyte2[0] = abyte0[0] = abyte1[0] =-6;
        for(int i = maxr; i >= 1; i--)
        {
            float f = (float)i / (float)maxr;
        
            abyte0[i] = (byte)blend(blend(Rl, 240, f), 250, 1.0F);
            abyte1[i] = (byte)blend(blend(Gl, 240, f), 250, 1.0F);
            abyte2[i] = (byte)blend(blend(Bl, 240, f), 250, 1.0F);
        }        IndexColorModel indexcolormodel = new IndexColorModel(8, maxr, abyte0, abyte1, abyte2, 0);
        balls = applet.createImage(new MemoryImageSource(40, 40, indexcolormodel, data, 0, 40));
    }    
    static 
    {
        data = new byte[1600];
       
       
       int i = 0;
        for(int j = 40; --j >= 0;)
        {
            int k = (int)(Math.sqrt(400 - (j - 20) * (j - 20)) + 0.5D);
            int l = (j * 40 + 20) - k;
            for(int i1 = -k; i1 < k; i1++)
            {
                int j1 = i1 + 5;
                int k1 = (j - 20) + 5;
                int l1 = (int)(Math.sqrt(j1 * j1 + k1 * k1) + 0.5D);
                if(l1 > i)
                    i = l1;
                data[l++] = l1 > 0 ? (byte)l1 : 1;
            }        }        maxr = i;
    }
}