import java.applet.*;
import java.awt.*;


public class fear extends Applet {
    Graphics g; 
        int height_add = 50;
        int width_rect =200;
        int height_rect = 220;
   
        Color text_color;
        Color shade_color;
        boolean unter;

        public  int title =1;
        public String colorBackground;
        int curY  = 0;

        final Font font_min   = new Font("Helvetica", Font.PLAIN+Font.BOLD,16);
        final Font font_max   = new Font("Times New Roman", Font.PLAIN+Font.BOLD, 33);

        FontMetrics fmetrics;

        final Color red1 = new Color(234,22,75);
        final Color red2 = new Color(253,245,247);
        final Color black = new Color(0,0,0);
        final Color gray = new Color(214,214,214);
 
public void paint(Graphics g)
    {      
        curY  = 0;
       shade_color = black;
    if (title == 1) title1_out (g, red1,black);

    if (title == 2) 
      {
        shade_color = gray;
        title1_out (g,red2,red1);

        text_color = Color.black;
        shade_color = red1;
        g.setFont(font_min);

        fmetrics = g.getFontMetrics();
        int height  = fmetrics.getAscent();
        int step = (height_rect - 12)/9-height ;

        curY  = 0;

        line_out (g,"Любовь",1,false,step);
        line_out (g,"есть",1,false,step);
        line_out (g,"достояние",1,false,step);
        line_out (g,"совершенных,",1,false,step);
        line_out (g,"а достояние",1,false,step);
        line_out (g,"благочестивых и",1,false,step);
        line_out (g,"спасающихся",1,false,step);
        line_out (g,"есть",1,false,step);
        line_out (g,"страх Божий",1,false,step);
   
        line_out (g,"             Еп. Игнатий",1,false,step+12);
        line_out (g,"        (Брянчанинов)",1,false,step-3);

      }

   }



void title1_out(Graphics g, Color col, Color fon)
{       
        g.setColor(Color.white);
        g.fillRect(0,0,width_rect,height_rect);
        g.setColor(fon);
        g.fillRect(0,height_rect,width_rect,height_add);

        text_color = col;
        shade_color = Color.black;
        g.setFont(font_max);

        fmetrics = g.getFontMetrics();

        line_out (g,"О СТРАХЕ",1,false,55); 
        line_out (g,"БОЖИЕМ",1,false,25);  
}
    

void line_out(Graphics g, String text, int shade, boolean under,int step)
{       
        g.setColor(text_color);
        fmetrics = g.getFontMetrics();
        int len = fmetrics.stringWidth(text);
        int curX = (width_rect- len)/2;
        int height  = fmetrics.getAscent();
        curY  = curY + height + step;
        if (shade != 0)
           {
               g.setColor(shade_color);
               g.drawString(text,curX+shade,curY+shade);
               g.setColor(text_color);
               g.drawString(text,curX,curY);
           }
        if (under == true) 
           {
        if (shade != 0)
           {
               g.setColor(shade_color);
               g.fillRect(curX+1,curY+5,len+1,2);
            }
                g.setColor(text_color);
                g.fillRect(curX,curY+4,len,2);

           }
}


 
public void changeTitle ()
    {      
         if (title == 1) 
                {title=2; colorBackground = "EA164B"; shade_color = black;}
         else 
                {title=1; colorBackground = "000000"; shade_color = gray;
}
         repaint();
    }

}