//   Help Materials for  "Take-it-to-the-Hoop" Programming Test.

//   Did you really think that I would give you a programming test,
//   then give you the source listing?
//   The "Take-the-Ball-to-the-Hoop" program was built from this one:
//   Show me what you can do!
//   JA.  05.24.99


//CIS  790          L.A.T.T.C              PROF. AUCIELLO
// Programmed by Joseph Auciello, CIS Professor, LA Trade Technical College.
// titthjav.htm
/*  TOPICS
    coordinates are  col, row = (x,y) = hor, ver

*/

import corejava.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.awt.Graphics;
import java.awt.Font;
import java.awt.Color;
import java.awt.Image.*;
import java.lang.Math;
import java.util.Date;
import java.util.Random;
import java.util.*;

public class titth extends Applet
{ // all definitions and initializations can go here.
 
   TextField textField0, textField1, textField2, textField3, 
             textField4, textField5, textField6;
             // defines variable textFields
             // 'awt' (abstract windows toolkit) contains 
             // components, such as:  Buttons, Text Fields, etc.
                           
   Font font2 = new Font("TimesRoman", Font.ITALIC, 20);
   // Font font3 = new Font("Helvetica", Font.BOLD, 20);
   Font font5 = new Font("Symbol", Font.BOLD, 20);

   public void init()
     { Label namelabel0 = new Label("Font Size:",Label.LEFT);
       add(namelabel0);  
       textField0 = new TextField(4);
       add(textField0);
       textField0.setText("20");
       
       Label namelabel1 = new Label("     Font Height:",Label.RIGHT);
       add(namelabel1);  
       textField1 = new TextField(4);
       add(textField1);
       textField1.setText("15");
                                         
       Label namelabel2 = new Label("    X (Hor):",Label.RIGHT);
       add(namelabel2);  
       textField2 = new TextField(4);
       add(textField2);
       textField2.setText("70");

       Label namelabel3 = new Label("    Y (Ver):",Label.RIGHT);
       add(namelabel3);  
       textField3 = new TextField(9);
       add(textField3);
       textField3.setText("150");

       Label namelabel4 = new Label("    Red:",Label.RIGHT);
       add(namelabel4);  
       textField4 = new TextField(3);
       add(textField4);
       textField4.setText("75");

       Label namelabel5 = new Label("    Green:");
       add(namelabel5);  
       textField5 = new TextField(3);
       add(textField5);
       textField5.setText("75");

       Label namelabel6 = new Label("    Blue:",Label.RIGHT);
       add(namelabel6);  
       textField6 = new TextField(3);
       add(textField6);
       textField6.setText("250");

     }  // end init()

   public void paint(Graphics g)
     { Font fonts   = new Font("Helvetica",Font.BOLD + Font.ITALIC,18);
       g.setFont(fonts);
       g.setColor(new Color(22,22,225));  // base color 
       g.drawString("Put line3 on line6 for shadow effect like this!",85,74);

       String reds     = textField4.getText();
       String greens   = textField5.getText();
       String blues    = textField6.getText();
       int red         = Integer.parseInt(reds);
       int green       = Integer.parseInt(greens);
       int blue        = Integer.parseInt(blues);
       g.setColor(new Color(225,25,25)); // top color 
       g.drawString("Put line3 on line6 for shadow effect like this!",87,74);

       // 1st line.
       String s    = textField0.getText();
       int height0 = Integer.parseInt(s);
       Font font0  = new Font("TimesRoman", Font.PLAIN, height0);
       g.setFont(font0);
       int verx    = 100;
       g.drawString("TimesRoman, font height "+height0+" (1)", 70, verx);
       verx += 1.25*height0;

       // 2nd line.
       FontMetrics fontMetrics = g.getFontMetrics(font0);
       int height1 = fontMetrics.getHeight();
       // get height (attribute) of 'font0'.
       Font font1= new Font("Helvetica", Font.PLAIN, height1);
       // Note: Can't define font1 until 'height' is defined. Of Course!
       g.setFont(font1);
       g.drawString("font height "+height1+" (based on 1st line) (2)", 70, verx);
       verx += 1.25*height0;

       // 3rd line.
       String    hors  = textField2.getText();
       int       hor   = Integer.parseInt(hors);
       String    vers  = textField3.getText();
       int ver         = Integer.parseInt(vers);
       // g.drawString("X @hor "+hor+", ver "+ver+" (3)", 70, verx);
       // verx += height0;
       Font   font3    = new Font("Symbol",Font.BOLD + Font.ITALIC,height1);
       g.setFont(font3);
       g.drawString("Quality in Motion (3)",hor,ver);

       // 4th, 5th, 6th lines.
       g.setColor(new Color(red,green,blue));
       String height3s = textField1.getText();
       int    height3  = Integer.parseInt(height3s);
       Font   font4    = new Font("TimesRoman", Font.PLAIN, height3);
       g.setFont(font4);
       g.drawString("Font Height=" + height3 + " in " + red+" "+green+" "+blue+" (4)",70,verx+20);
       g.setFont(font5);
       g.drawString("Symbol Font in rgb composite color (5).", 70, verx+50);
       g.setFont(font3);
       g.drawString("Quality in Motion (6)",70, verx+80);

     }  // end paint()
    public boolean action(Event event, Object arg)
     {  repaint();
        return true;
     }  
}  // end class


// ---------------------------------------------------------------
// titthjav.htm