*: 
  
public class fourdown extends driveendclass { 
 
/*constructor*/ public fourdown( 
 ftbteam t, ftbteam dt) { 
 this.t=t; this.dt=dt; 
 this.endcode=5; /*code for 4th down*/ 
 this.endstring="4D"; 
 this.descriptionincluded=false; 
} /*end constructor*/ 
 
/*method*/ String description() {return " ";} 
 
/*method*/ void updatestats() { 
super.updatestats(); 
} 
 
} /*end fourdown*/ 
  
  
*: 
  
public class touchdown extends driveendclass { 
 
/*constructor*/ public touchdown(ftbteam t, ftbteam dt) { 
  endstring="TD"; 
  endcode=1; 
  this.t=t; this.dt=dt; 
  this.descriptionincluded=false; 
 
} /*end constructor*/ 
 
/*method*/ String description() {return " ";} 
 
/*method*/ void updatestats() { 
super.updatestats(); 
} /*end updatestats*/ 
 
 
} /*end touchdown*/ 
 
  
  
*: 
  
public class eoh extends driveendclass { 
 
/*constructor*/ public eoh( 
 ftbteam t, ftbteam dt) { 
 this.t=t; this.dt=dt; 
 this.endcode=9; /*code for 4th down*/ 
 this.endstring="EOH"; 
 this.descriptionincluded=false; 
} /*end constructor*/ 
 
/*method*/ String description() {return " ";} 
 
/*method*/ void updatestats() { 
super.updatestats(); 
} 
 
} /*end eoh*/ 
  
  
*: 
  
public class fieldgoalscrim  extends scrimmageplayclass { 
void updatestats() {} 
String x; 
public fieldgoalscrim(String x) {this.x=x;} 
String description(){ return x;} 
} 
  
  
*: 
  
public class missedfieldgoal extends driveendclass { 
 
/*constructor*/ public missedfieldgoal( 
 ftbteam t, ftbteam dt) { 
 this.t=t; this.dt=dt; 
 this.endcode=3; /*code for mfg*/ 
 this.endstring="mfg"; 
 this.descriptionincluded=true; 
} /*end constructor*/ 
 
/*method*/ String description() { 
return "missed field goal"; 
} 
 
/*method*/ void updatestats() { 
super.updatestats(); 
} 
 
} /*end missedfieldgoal*/ 
  
  
*: 
  
public class returntdclass extends scrimmageplayclass { 
void updatestats() {} 
 
ftbteam t; int playerid; int gain; String returntype; 
 
public returntdclass(ftbteam t, int playerid, int gain, 
String returntype) { 
this.t=t; this.playerid=playerid; this.gain=gain; 
this.returntype=returntype; 
} 
 
String description(){ 
return t.player[playerid].name+" "+gain+" "+returntype+" return";} 
} /*end returntdclass*/ 
  
  
*: 
  
public class yardlineclass { 
private int ydline=0; 
 
/*method*/ String ydline2() { 
if (ydline>50) 
     {return fscore.t2.abbrev+(100-ydline) /** +"("+ydline+")"**/;} 
     else {return fscore.t1.abbrev+(ydline) /**+"("+ydline+")"**/;} 
} /*end ydline2*/ 
 
/*constructor method*/ public yardlineclass(int ydline) { 
this.ydline=ydline;} 
 
 
} /*end yardlineclass*/ 
  
  
*: 
  
import java.awt.*; 
 
public class  screenparam { 
 
 
int lm; /*left margin*/ 
int tm; /* top margin*/ 
int w;  /*column width*/ 
int h;  /*row height*/ 
Font f0; 
 
/*constructor method*/ public  screenparam(int  lm, int  tm, 
int  w, int  h, Font f0) { 
this .lm=lm; this .tm=tm; 
this .w=w; this .h=h; 
this.f0=f0; 
 
} /*end constructor*/ 
 
 
} /*end screenparam*/ 
 
 
 
  
  
*: 
  
public class safety extends driveendclass { 
 
/*constructor*/ public safety(ftbteam t, ftbteam dt) { 
  endstring="Saf"; 
  endcode=8; 
  this.t=t; this.dt=dt; 
  this.descriptionincluded=false; 
 
} /*end constructor*/ 
 
/*method*/ String description() {return " ";} 
 
/*method*/ void updatestats() { 
/*super.updatestats();*/ 
dt.drivelist[8]++; 
} /*end updatestats*/ 
 
 
} /*end safety*/ 
 
  
  
*: 
  
public class sackplayclass extends scrimmageplayclass { 
ftbteam t; 
 
public sackplayclass(ftbteam t, int gain) { 
  this.t=t; this.gain=gain; 
 } 
 
/*method*/ void updatestats() { 
t.totpassyds+=gain; 
t.numsacks++; 
t.sackyards-=gain; /*gain is a negative number for a sack*/ 
} /*end updatestats*/ 
 
/*method*/ String description() { 
return "Sack: "+(-gain)+" yard loss"; 
} /*end description*/ 
 
} /*end sackplayclass*/ 
 
  
  
*: 
  
public class puntclass extends driveendclass { 
int playerid; int gain; String notestring=""; 
 
/*constructor*/ public puntclass( 
 ftbteam t, ftbteam dt, int playerid, int gain, 
 String notestring) { 
 this.t=t; this.dt=dt; 
 this.playerid=playerid; this.gain=gain; 
 this.endcode=4; /*code for punt*/ 
 this.endstring="Punt"; 
 this.descriptionincluded=true; 
 this.notestring=notestring; 
} /*end constructor*/ 
 
/*method*/ String description() { 
return t.player[playerid].name+" "+gain+" punt   "+notestring; 
} 
 
/*method*/ void updatestats() { 
t.player[playerid].stat.punts++; 
t.player[playerid].stat.puntyds+=gain; 
super.updatestats(); 
} 
 
 
} /*end puntclass*/ 
  
  
*: 
  
public class fumble extends driveendclass { 
 int down=1;   String notestring; 
 
/*constructor*/ public fumble( 
 ftbteam t, ftbteam dt, int down, String notestring) { 
 this.t=t; this.dt=dt; 
 this.endcode=7; /*code for fumble*/ 
 this.endstring="Fum"; 
 this.descriptionincluded=true; 
 this.down=down; 
 this.notestring=notestring; 
} /*end constructor*/ 
 
/*method*/ String description() { 
return "Fumble "+notestring; 
} 
 
/*method*/ void updatestats() { 
t.numdowns[down]++; 
super.updatestats(); 
} 
 
} /*end fumble*/ 
  
  
*: 
  
public class puntreturnclass extends returnclass { 
 
/*constructor*/ public puntreturnclass(int playerid, int gain, 
 boolean tdscored, int quarter, ftbteam t, ftbteam dt, String notestring) { 
 
 super(playerid, gain, tdscored, quarter,t, dt, notestring); 
} /*end returnclass*/ 
 
/*method*/ void updatestats() { 
t.player[playerid].stat.puntrets++; 
t.player[playerid].stat.puntretyds+=gain; 
} 
 
/*method*/ String description() { 
return t.abbrev+": "+t.player[playerid].name+" "+gain+" punt return  "+ 
notestring; 
 
} /*end description*/ 
 
} /*end puntreturnclass*/ 
  
  
*: 
  
public abstract class returnclass { 
 int playerid=0; 
 int gain=0; 
 boolean tdscored=false; 
 int quarter=1; 
 ftbteam t; 
 ftbteam dt; 
 String notestring=""; 
 
/*constructor*/ public returnclass( 
 int playerid, int gain, boolean tdscored, 
 int quarter,  ftbteam t,  ftbteam dt, String notestring) { 
 this.playerid=playerid; this.gain=gain; 
 this.tdscored=tdscored; 
 this.quarter=quarter; 
 this.t=t;  this.dt=dt; 
 this.notestring=notestring; 
 } /*end constructor*/ 
 
/*method*/ abstract void updatestats(); 
 
/*method*/ abstract String description(); 
 
} /*end retclass*/ 
  
  
*: 
  
public class kickreturnclass extends returnclass { 
 
/*constructor*/ public kickreturnclass(int playerid, int gain, 
 boolean tdscored, int quarter, ftbteam t, ftbteam dt, String notestring) { 
 super(playerid, gain, tdscored, quarter,t, dt, notestring); 
} /*end returnclass*/ 
 
/*method*/ void updatestats() { 
t.player[playerid].stat.kickrets++; 
t.player[playerid].stat.kickretyds+=gain; 
} 
 
/*method*/ String description() { 
return t.abbrev+": "+t.player[playerid].name+" "+gain+" kickoff return"+ 
"; "+notestring; 
 
} /*end description*/ 
 
} /*end kickreturnclass*/ 
  
  
*: 
  
public class fumbreturnclass extends returnclass { 
 
/*constructor*/ public fumbreturnclass(int playerid, int gain, 
 boolean tdscored, int quarter, ftbteam t, ftbteam dt, String notestring) { 
 
 super(playerid, gain, tdscored, quarter,t, dt, notestring); 
} /*end returnclass*/ 
 
/*method*/ void updatestats() { 
 
} 
 
/*method*/ String description() { 
return t.abbrev+": "+t.player[playerid].name+" "+gain+" fumble return  "+ 
notestring; 
 
} /*end description*/ 
 
} /*end fumbreturnclass*/ 
  
  
*: 
  
public abstract class scrimmageplayclass { 
 
int gain;  int tddist; 
 
abstract void updatestats(); 
 
abstract String description(); 
 
 
} /*end scrimmageplayclass*/ 
  
  
*: 
  
import java.awt.*; 
 
public class diagramparameters { 
int x1; int y1; int x2; int y2; Color c; 
int diagramrow; int rowoffset;  int rowadvance; 
int linestyle;  int direction; 
 
/*constructor method*/ public diagramparameters 
(int x1, int y1, int x2, int y2, Color c, 
int diagramrow, int rowoffset, int rowadvance, 
int direction, int linestyle) { 
this.x1=x1; this.y1=y1; this.x2=x2; this.y2=y2; 
this.c=c; 
this.diagramrow=diagramrow; 
this.rowoffset=rowoffset; 
this.rowadvance=rowadvance; 
this.linestyle=linestyle; 
this.direction=direction; 
} /*end constructor*/ 
} /*end class diagramparameters*/ 
 
 
  
  
*: 
  
public class fieldgoal extends driveendclass { 
int yttd; 
 
/*constructor*/ public fieldgoal(ftbteam t, ftbteam dt, int yttd) { 
  endstring="FG"; 
  endcode=2; 
  this.t=t; this.dt=dt; 
  this.yttd=yttd; 
  this.descriptionincluded=true; 
 
} /*end constructor*/ 
 
/*method*/ String description() 
{return "FG - " + t.player[t.kicker].name+"  "+(yttd+17)+" yards"; 
} 
 
/*method*/ void updatestats() { 
super.updatestats(); 
} /*end updatestats*/ 
 
 
} /*end fieldgoal*/ 
 
  
  
*: 
  
public class intreturnclass extends returnclass { 
 
/*constructor*/ public intreturnclass(int playerid, int gain, 
 boolean tdscored, int quarter, ftbteam t, ftbteam dt, String notestring) { 
 
 super(playerid, gain, tdscored, quarter,t, dt, notestring); 
} /*end returnclass*/ 
 
/*method*/ void updatestats() { 
t.player[playerid].stat.interceptions++; 
t.player[playerid].stat.intretyds+=gain; 
} 
 
/*method*/ String description() { 
return t.abbrev+": "+t.player[playerid].name+" "+gain+" interception return  "+ 
 notestring; 
 
} /*end description*/ 
 
} /*end intreturnclass*/ 
  
  
*: 
  
public class penplayclass extends scrimmageplayclass { 
ftbteam t;  ftbteam dt; 
int rushpl; 
 
public penplayclass(ftbteam t, ftbteam dt, int gain) { 
  this.t=t;  this.dt=dt; 
  this.gain=gain; 
 } 
 
/*method*/ void updatestats() { 
if (gain<0) {t.penaltyyards-=gain; 
              t.penalties++;} 
   else {dt.penaltyyards+=gain; 
           dt.penalties++;} 
} /*end updatestats*/ 
 
/*method*/ String description() { 
String penaltydescription=""; 
if (gain<0) {penaltydescription=t.teamname+" "+gain+" penalty";} 
else {penaltydescription=dt.teamname+" "+gain+" penalty";} 
return penaltydescription; 
} /*end description*/ 
 
} /*end penplayclass*/ 
 
  
  
*: 
  
public class rushplayclass extends scrimmageplayclass { 
ftbteam t; 
int rushpl; 
 
public rushplayclass(ftbteam t, int rushpl, int gain, int tddist) { 
  this.t=t;  this.rushpl=rushpl; this.gain=gain; 
  this.tddist=tddist; 
 } 
 
 
/*method*/ void updatestats() { 
t.player[rushpl].stat.tcb++; 
if (gain>=0) {t.player[rushpl].stat.yg+=gain;} 
else {t.player[rushpl].stat.yl-=gain;} 
fscore.currplay.totrushyds+=gain; 
t.totrushyds+=gain; 
if (gain>=tddist) {t.player[rushpl].stat.rtd++;} 
 
int k=1;  int j=rushpl; 
 
while ((t.player[j].stat.net2()=(k+1); k4--) { 
   t.rushlist[k4]=t.rushlist[k4-1]; 
   } 
   t.rushlist[k]=rushpl; 
} /*end new rusher is not at top now*/ 
 
} /*end updatestats*/ 
 
/*method*/ String description() { 
return t.player[rushpl].name+" "+gain+" run"; 
} /*end description*/ 
 
} /*end rushplayclass*/ 
 
  
  
*: 
  
public class passplayclass extends scrimmageplayclass { 
ftbteam t; 
int passpl; 
int recpl; 
 
public passplayclass(ftbteam t, int passpl, int recpl, int gain, 
int tddist) { 
  this.t=t;  this.passpl=passpl; this.recpl=recpl; 
  this.gain=gain;  this.tddist=tddist; 
 } 
 
/*method*/ void updatestats() { 
t.player[passpl].stat.pa++; 
if (recpl>0) { 
t.player[passpl].stat.pc++; 
t.player[passpl].stat.pyds+=gain; 
t.player[recpl].stat.rec++; 
t.player[recpl].stat.rcyds+=gain; 
if (gain>=tddist) {t.player[passpl].stat.ptd++; 
               t.player[recpl].stat.rctd++;} 
    /*******sort quarterbacks*******/ 
int k=1;  int j=passpl; 
 
while ((t.player[j].stat.pyds=(k+1); k4--) { 
   t.passlist[k4]=t.passlist[k4-1]; 
   } 
   t.passlist[k]=passpl; 
} /*end new passer is not at top now*/ 
 
  /*****sort receivers*********/ 
 
k=1;   j=recpl; 
 
while ((t.player[j].stat.rcyds=(k+1); k4--) { 
   t.reclist[k4]=t.reclist[k4-1]; 
   } 
   t.reclist[k]=recpl; 
} /*end new passer is not at top now*/ 
 
   } 
fscore.currplay.totpassyds+=gain; 
t.totpassyds+=gain; 
} /*end updatestats*/ 
 
/*method*/ String description() { 
String z=""; 
if (recpl>0) {z=t.player[recpl].name+" "+gain+" pass from "+ 
         t.player[passpl].name;} 
    else {z=t.player[passpl].name+" incomplete pass";} 
return z; 
} /*end description*/ 
 
} /*end passplayclass*/ 
 
  
  
*: 
  
public class footballtime { 
 
int drivestarttime=0; /*seconds since start of game*/ 
int driveendtime=0; 
int timeofdrive=0; 
String clocktime; /*at end of drive*/ 
 
/*constructor*/ public footballtime( 
  String clocktime, int quarter, int previousdriveendtime) { 
  this.clocktime=clocktime; 
try { 
  int L=clocktime.indexOf(":"); 
 
  int minutes= Integer.parseInt(clocktime.substring(0,L).trim()); 
  int seconds= Integer.parseInt(clocktime.substring(L+1).trim()); 
  /*System.out.println("min:"+minutes+"  sec:"+seconds);*/ 
  driveendtime=(15*60*(quarter-1))+(15*60-(60*minutes+seconds)); 
} catch (Exception ex) {driveendtime=previousdriveendtime; } 
  drivestarttime=previousdriveendtime; 
  timeofdrive=driveendtime-drivestarttime; 
} /*end constructor*/ 
 
 
/*method*/ static String footballclock(int seconds) { 
  int minutes=seconds/60; 
  int seconds2=seconds%60; 
 if (seconds2>10) {return ( ""+minutes+":"+seconds2);} 
              else {return (""+minutes+":0"+seconds2);} 
} /*end footballclock*/ 
 
} /*end class football time*/ 
  
  
*: 
  
public abstract class driveendclass { 
  String endstring=""; 
  int endcode=0; 
 ftbteam t; ftbteam dt; 
  boolean descriptionincluded=false; 
 
abstract String description(); 
 
/*method*/ void updatestats() { 
/*System.out.println("in driveendclass: updatestats: endcode="+endcode);*/ 
   t.drivelist[endcode]++; 
} /*end updatestats*/ 
 
 
} /*end driveendclass*/ 
 
 
  
  
*: 
  
public class interception extends driveendclass { 
 
int thrower;  int interceptor; 
int down; String notestring=""; 
 
/*constructor*/ public interception( 
 ftbteam t, ftbteam dt, int thrower, int interceptor, 
 int down, String notestring) { 
 this.t=t; this.dt=dt; 
 this.thrower=thrower; 
 this.interceptor=interceptor; 
 this.endcode=6; /*code for interception*/ 
 this.endstring="Int"; 
 this.descriptionincluded=true; 
 this.down=down; 
 this.notestring=notestring; 
} /*end constructor*/ 
 
/*method*/ String description() { 
/*System.out.println("intercepting team:"+dt.teamname+"  player="+interceptor);*/ 
return t.player[thrower].name+"  intercepted by "+ 
dt.player[interceptor].name+" "+notestring; 
} 
 
/*method*/ void updatestats() { 
t.player[thrower].stat.pa++; 
t.player[thrower].stat.hi++; 
t.numdowns[down]++; 
super.updatestats(); 
} 
 
 
} /*end interception*/ 
  
  
*: 
  
import java.awt.* ; 
import java.awt.event.* ; 
import java.io.*; 
 
public class  readteam extends Dialog 
implements ActionListener   { 
/*message box*/ 
 
/*This class creates a dialog box allowing the user to 
read in names, positions, and numbers for a football 
team; these names can then be saved in a file to use 
with the fscore prigram*/ 
 
   int maxplayer=100; /*maximum players that can be read in*/ 
   Button  okbtn; 
   Button cancelplayerbutton; 
   Button cancelteambutton; 
   Button savefilebtn; 
   TextField playernametf; 
   TextField playernumbertf; 
   TextField playerpositiontf; 
   TextField lastplayerreadtf; 
   String playerlist[]=new String[maxplayer]; 
   int i=0; 
   Frame parent; 
 
   boolean oktocontinue=false; 
    String notestring=""; 
 
/*constructor*/ public  readteam(Frame  parent, 
      String  msg) { 
 
   super (parent,"Enter player information", true); 
         /*the previous line calls the constructor of 
           the superclass, which is Dialog*/ 
         /*parent represents the frame that is the 
           parent of this dialog box, which is passed 
           to the constructor as a parameter in the 
           calling program*/ 
         /*true means that this will be a modal dialog 
           box, which means that user must clear it before 
           other processing will proceed*/ 
   this.parent=parent; 
   setLayout(new GridLayout (4,1)); 
   Panel namepanel=new Panel(); 
   Label namelabel=new Label("Name:"); 
   playernametf=new TextField(40); 
   namepanel.add(namelabel); 
   namepanel.add(playernametf); 
   add(namepanel); 
   Panel numberpositionpanel= new Panel(); 
   Label numberlabel=new Label("Number:"); 
   playernumbertf=new TextField(2); 
   Label positionlabel=new Label("Position:"); 
   playerpositiontf=new TextField(3); 
   numberpositionpanel.add(numberlabel); 
   numberpositionpanel.add(playernumbertf); 
   numberpositionpanel.add(positionlabel); 
   numberpositionpanel.add(playerpositiontf); 
   add(numberpositionpanel); 
   lastplayerreadtf=new TextField(50); 
   lastplayerreadtf.setEditable(false); 
   add(lastplayerreadtf); 
   Panel buttonpanel=new Panel(); 
   okbtn = new Button ("OK"); 
   okbtn.addActionListener(this) ; 
   buttonpanel.add(okbtn); 
   savefilebtn=new Button("SaveFile"); 
   savefilebtn.addActionListener(this); 
   buttonpanel.add(savefilebtn); 
   cancelplayerbutton=new Button ("Erase Prev. Player"); 
   cancelplayerbutton.addActionListener(this); 
   buttonpanel.add(cancelplayerbutton); 
   cancelteambutton=new Button("Quit"); 
   cancelteambutton.addActionListener(this); 
   buttonpanel.add(cancelteambutton); 
   add(buttonpanel); 
   setBounds(10,10,400,270); 
  } /*end constructor*/ 
 
public void actionPerformed(ActionEvent  e) { 
String  btn= e.getActionCommand (); 
 
if  (btn.equals ("OK")) { 
    try { 
    String numberstring=playernumbertf.getText().trim(); 
    int playernumber=Integer.parseInt(numberstring); 
    String playerstring=playernametf.getText().trim()+","+ 
    playernumber+","+playerpositiontf.getText().toUpperCase().trim(); 
    i++; 
    playerlist[i]=playerstring; 
    lastplayerreadtf.setText("previous player: "+playerstring); 
    playernametf.setText(""); 
    playernumbertf.setText(""); 
    playerpositiontf.setText(""); 
    playernametf.requestFocus(); 
    } catch (Exception ex) { } /*ignore invalid input*/ 
   } /*end if OK*/ 
 
    if (btn.equals("SaveFile")) { 
      readteamname rtn=new readteamname(parent,"Enter team name"); 
      rtn.setVisible(true); 
      FileDialog fd=new 
             FileDialog(parent,"Enter name of file (use extension .team)", 
         FileDialog.SAVE); 
       fd.setVisible(true); 
      String filename=fd.getFile(); 
      try { 
      DataOutput f1=new DataOutputStream(new FileOutputStream(filename)); 
      f1.writeBytes(rtn.teamnametf.getText()+"\r\n"); 
      f1.writeBytes(rtn.teamabbrevtf.getText()+"\r\n"); 
      for (int j=1; j<=i; j++) { 
          f1.writeBytes(playerlist[j]+"\r\n"); 
          } /*end j loop*/ 
      setVisible(false);  dispose(); 
       } catch(Exception ex) {String err=ex.toString(); 
                         System.out.println(err);} 
    } /*end if SaveFile*/ 
 
  if (btn.equals("Erase Prev. Player")) { 
    playernametf.setText(""); 
    playernumbertf.setText(""); 
    playerpositiontf.setText(""); 
    playerlist[i]=""; 
    i--; 
    if (i>=1) {lastplayerreadtf.setText("previous player: "+playerlist[i]);} 
          else {lastplayerreadtf.setText(" ");} 
    } /*end Erase Prev. Player*/ 
 
   if (btn.equals("Quit")) { 
      confirmbox c1=new confirmbox(parent, 
      "Click OK to quit entering this team without saving"); 
      c1.setVisible(true); 
      if (c1.oktocontinue) {setVisible(false);  dispose();} 
     } /*end cancel teambutton*/ 
 
} /*end actionPerformed*/ 
}  /*end readteam*/ 
 
  
  
*: 
  
import java.awt.* ; 
import java.awt.event.* ; 
import java.io.*; 
 
public class  readteamname extends Dialog 
implements ActionListener   { 
/*message box*/ 
 
   Button  okbtn; 
   TextField teamnametf; 
   TextField teamabbrevtf; 
   String teamname=""; 
   String teamabbrev=""; 
 
/*constructor*/ public  readteamname(Frame  parent, 
      String  msg) { 
 
   super (parent,"Enter player information", true); 
         /*the previous line calls the constructor of 
           the superclass, which is Dialog*/ 
         /*parent represents the frame that is the 
           parent of this dialog box, which is passed 
           to the constructor as a parameter in the 
           calling program*/ 
         /*true means that this will be a modal dialog 
           box, which means that user must clear it before 
           other processing will proceed*/ 
   setLayout(new BorderLayout()); 
   Panel namepanel=new Panel(); 
   Label namelabel=new Label("Team Name:"); 
   teamnametf=new TextField(20); 
   Label teamabbrevlabel=new Label("Team Abbreviation:"); 
   teamabbrevtf=new TextField(1); 
   namepanel.add(namelabel); 
   namepanel.add(teamnametf); 
   namepanel.add(teamabbrevlabel); 
   namepanel.add(teamabbrevtf); 
   add(BorderLayout.CENTER,namepanel); 
   okbtn = new Button ("OK"); 
   okbtn.addActionListener(this) ; 
   add(BorderLayout.SOUTH,okbtn); 
   setBounds(10,10,500,150); 
  } /*end constructor*/ 
 
public void actionPerformed(ActionEvent  e) { 
String  btn= e.getActionCommand (); 
 
if  (btn.equals ("OK")) { 
    teamname=teamnametf.getText(); 
    teamabbrev=teamabbrevtf.getText(); 
    setVisible(false); dispose(); 
    } /*end if*/ 
 
} /*end actionPerformed*/ 
}  /*end readteamname*/ 
 
  
  
*: 
  
import java.awt.*; 
import java.awt.event.*; 
 
public class colorselector extends Dialog 
implements MouseListener { 
 
/*This dialog box displays a chart showing many different 
colors; the user can click on one of these colors to make 
a selection.*/ 
 
Color selectedcolor=null; 
 
/*constructor*/ public colorselector(Frame parent, String title) { 
super(parent, title, true); 
addMouseListener(this); 
setBounds(10,10,(numcol1+numcol2+2)*w+lm,(2*n+2)*h+tm); 
} /*end constructor*/ 
 
int w=36;  int h=18;  int n=10; 
int numcol1=11;   int numcol2=7; 
int lm=2; int tm=20; 
int a[][] = { 
   {0,0,0}, 
   {255,0,0}, 
   {255,128,0}, 
   {255,255,0}, 
   {128,255,0}, 
   {0,255,0}, 
   {0,255,128}, 
   {0,255,255}, 
   {0,128,255}, 
   {0,0,255}, 
   {128,0,255}, 
   {255,0,255} 
   }; 
 
int b[][] = { 
   {0,0,0,0,0,0}, 
   {255,0,0,0,255,0}, 
   {0,255,0,0,0,255}, 
   {0,0,255,255,0,0}, 
   {255,0,0,255,255,0}, 
   {255,255,0,255,0,255}, 
   {255,0,255,0,255,255}, 
   {0,0,0,255,255,255} 
    }; 
 
/*method*/ Color squarecolor(int r1, int g1, int b1, 
 int r2, int g2, int b2, int i, int n) { 
Color c=new Color( (r1+i*(r2-r1)/n), (g1+i*(g2-g1)/n), 
   (b1+i*(b2-b1)/n)); 
   return c; 
} /*end setcolor*/ 
 
public void mouseMoved(MouseEvent e) {} 
public void mouseDragged(MouseEvent e) {} 
public void mouseReleased(MouseEvent e) {} 
public void mouseClicked(MouseEvent e) {} 
public void mouseEntered(MouseEvent e) {} 
public void mouseExited(MouseEvent e) {} 
 
/*method*/ void drawsquare(int i, int j, Color c, Graphics g) { 
int x=lm+j*(w+2); 
int y=tm+i*(h+2); 
g.setColor(Color.white); 
g.fillRect(x,y,w,h); 
g.setColor(Color.black); 
g.fillRect(x+2,y+2,w,h); 
g.setColor(c); 
g.fillRect(x+1,y+1,w,h); 
} /*end drawsquare*/ 
 
 
public void paint(Graphics g) { 
 
 
 
for (int j=1; j <=numcol1; j++) { 
 
for (int i=0; i<=n; i++) { 
Color c=squarecolor(0,0,0,a[j][0],a[j][1],a[j][2],i,n); 
drawsquare(i,j,c,g); 
} /*end i loop*/ 
 
for (int i=0; i<=n; i++) { 
Color c=squarecolor(a[j][0],a[j][1],a[j][2],255,255,255,i,n); 
drawsquare((n+i),j,c,g); 
} /*end i loop*/ 
} /*end j loop*/ 
 
for (int j=1; j<=numcol2;  j++) { 
for (int i=0; i<=2*n; i++) { 
Color c=squarecolor(b[j][0],b[j][1],b[j][2],b[j][3],b[j][4],b[j][5],i,(2*n)); 
drawsquare(i,(j+numcol1),c,g); 
} /*end i loop*/ 
 
} /*end j*/ 
 
 
 
} /* end paint*/ 
 
/*method*/ public void mousePressed(MouseEvent e) { 
try { 
int j=(e.getX()-lm)/(w+2); 
if (j>(numcol1+numcol2)) {j=numcol1+numcol2;} 
int i=1+(e.getY()-tm)/(h+2); 
if (i>2*n) {i=2*n;} 
/*System.out.println("in color selector: j="+j+"  i="+i);*/ 
if (j<=numcol1) { 
if (i<=n) {selectedcolor=squarecolor(0,0,0,a[j][0],a[j][1],a[j][2],i,n);} 
else {selectedcolor=squarecolor(a[j][0],a[j][1],a[j][2],255,255,255,(i-n),n);} 
                 } 
else { int j2=j-numcol1; 
selectedcolor= 
  squarecolor(b[j2][0],b[j2][1],b[j2][2],b[j2][3],b[j2][4],b[j2][5],i,(2*n)); 
      } 
  } catch (Exception ex) {selectedcolor=Color.black;} 
/*System.out.println("red="+selectedcolor.getRed()+"  green="+ 
selectedcolor.getGreen()+"  blue="+selectedcolor.getBlue());*/ 
setVisible(false);  dispose(); 
 
} /*end mousePressed*/ 
 
} /*end class colorselector*/ 
  
  
*: 
  
import java.awt.* ; 
import java.awt.event.* ; 
 
public class  confirmbox extends Dialog 
implements ActionListener   { 
/*message box*/ 
 
/*This class creates a confirmation box, that 
other programs can use to display a message to 
the user*/ 
 
   Button  okbtn; 
   Button cancelbutton; 
   TextField  msgtext; 
   TextField notetext; 
   boolean oktocontinue=false; 
    String notestring=""; 
 
/*constructor*/ public  confirmbox(Frame  parent, 
      String  msg) { 
 
   super (parent,"Confirm", true); 
         /*the previous line calls the constructor of 
           the superclass, which is Dialog*/ 
         /*parent represents the frame that is the 
           parent of this dialog box, which is passed 
           to the constructor as a parameter in the 
           calling program*/ 
         /*true means that this will be a modal dialog 
           box, which means that user must clear it before 
           other processing will proceed*/ 
   setLayout(new BorderLayout ()); 
   Panel lowerpanel=new Panel(); 
   okbtn = new Button ("OK"); 
   okbtn.addActionListener(this) ; 
   lowerpanel.add(okbtn); 
   cancelbutton=new Button ("Cancel"); 
   cancelbutton.addActionListener(this); 
   lowerpanel.add(cancelbutton); 
   add(BorderLayout.SOUTH,lowerpanel); 
   msgtext = new TextField (50); 
   msgtext.setEditable (false); 
   msgtext.setText (msg); 
   add(BorderLayout .NORTH,msgtext); 
 
   notetext= new TextField(50); 
   notetext.setForeground(Color.green); 
   notetext.setBackground(Color.black); 
   notetext.setEditable(true); 
   notetext.setText("note:"); 
   add(BorderLayout.CENTER,notetext); 
   setBounds(10,20,500,150); 
  } /*end constructor*/ 
 
public void actionPerformed(ActionEvent  e) { 
String  btn= e.getActionCommand (); 
 
if  (btn.equals ("OK")) { 
    oktocontinue=true; 
    notestring=notetext.getText(); 
    int L=notestring.indexOf("note:"); 
    if (L>=0) {notestring=notestring.substring(5);} 
    setVisible(false) ;   dispose(); 
   } /*end if*/ 
 
else {if (btn.equals("Cancel")) { 
   oktocontinue=false; 
   setVisible(false);  dispose(); 
        } /*end if*/ 
   } /*end else*/ 
} /*end actionPerformed*/ 
}  /*end mbox*/ 
 
  
  
*: 
  
import java.awt.* ; 
import java.awt.event.* ; 
 
public class  standardcolorselector extends Dialog 
implements ActionListener   { 
/*This dialog box displays a choice box allowing 
the user to select a standard color*/ 
 
 Button  okbtn; 
 Button cancelbutton; 
 Choice colorchoice; 
 Color selectedcolor; 
 boolean oktocontinue=false; 
 
/*constructor*/ public standardcolorselector(Frame  parent, 
      String  msg) { 
 
   super (parent,msg, true); 
         /*the previous line calls the constructor of 
           the superclass, which is Dialog*/ 
         /*parent represents the frame that is the 
           parent of this dialog box, which is passed 
           to the constructor as a parameter in the 
           calling program*/ 
         /*true means that this will be a modal dialog 
           box, which means that user must clear it before 
           other processing will proceed*/ 
 
    setLayout(new BorderLayout()); 
    colorchoice=new Choice(); 
    colorchoice.addItem("red"); 
    colorchoice.addItem("orange"); 
    colorchoice.addItem("yellow"); 
    colorchoice.addItem("pink"); 
    colorchoice.addItem("magenta"); 
    colorchoice.addItem("blue"); 
    colorchoice.addItem("cyan"); 
    colorchoice.addItem("green"); 
    colorchoice.addItem("black"); 
    colorchoice.addItem("white"); 
    add(BorderLayout.CENTER,colorchoice); 
    Panel buttonpanel=new Panel(); 
    okbtn=new Button("OK"); 
    okbtn.addActionListener(this); 
    cancelbutton=new Button("Cancel"); 
    cancelbutton.addActionListener(this); 
    buttonpanel.add(okbtn); 
    buttonpanel.add(cancelbutton); 
    add(BorderLayout.SOUTH,buttonpanel); 
 
   setBounds(10,20,200,100); 
  } /*end constructor*/ 
 
 
public void actionPerformed(ActionEvent  e) { 
String  btn= e.getActionCommand (); 
 
if  (btn.equals ("OK")) { 
  String colorname=colorchoice.getSelectedItem(); 
  if (colorname.equals("red")) {selectedcolor=Color.red;} 
  if (colorname.equals("orange")) {selectedcolor=Color.orange;} 
  if (colorname.equals("yellow")) {selectedcolor=Color.yellow;} 
  if (colorname.equals("pink")) {selectedcolor=Color.pink;} 
  if (colorname.equals("magenta")) {selectedcolor=Color.magenta;} 
  if (colorname.equals("blue")) {selectedcolor=Color.blue;} 
  if (colorname.equals("cyan")) {selectedcolor=Color.cyan;} 
  if (colorname.equals("green")) {selectedcolor=Color.green;} 
  if (colorname.equals("black")) {selectedcolor=Color.black;} 
  if (colorname.equals("white")) {selectedcolor=Color.white;} 
    oktocontinue=true; 
    setVisible(false) ;  dispose(); 
   } /*end if*/ 
 
else {if (btn.equals("Cancel")) { 
   oktocontinue=false; 
   setVisible(false);  dispose(); 
        } /*end if*/ 
   } /*end else*/ 
} /*end actionPerformed*/ 
}  /*end standardcolorselector*/ 
 
  
  
*: 
  
import java.awt.* ; 
import java.awt.event.* ; 
 
public class  mbox extends Dialog  
implements ActionListener   { 
/*message box*/ 
 
/*This class creates a message box, that 
other programs can use to display a message to 
the user*/ 
 
   Button  okbtn; TextField  msgtext; 
 
/*constructor*/ public  mbox(Frame  parent, 
      String  msg) { 
 
   super (parent,"Message", true); 
         /*the previous line calls the constructor of 
           the superclass, which is Dialog*/ 
         /*parent represents the frame that is the 
           parent of this dialog box, which is passed 
           to the constructor as a parameter in the 
           calling program*/ 
         /*true means that this will be a modal dialog 
           box, which means that user must clear it before 
           other processing will proceed*/ 
   setLayout(new BorderLayout ()); 
   okbtn = new Button ("OK"); 
   okbtn.addActionListener(this) ; 
   add(BorderLayout .SOUTH,okbtn); 
   msgtext = new TextField (50); 
   msgtext.setEditable (false); 
   msgtext.setText (msg); 
   add(BorderLayout .NORTH,msgtext); 
   pack() ; /*make compact*/ 
  } /*end constructor*/ 
 
public void actionPerformed(ActionEvent  e) { 
String  btn= e.getActionCommand (); 
 
if  (btn.equals ("OK")) { 
    setVisible(false) ;  dispose(); 
   } /*end if*/ 
 
} /*end actionPerformed*/ 
}  /*end mbox*/ 
 
  
  
*: 
  
public class driveclass { 
 
returnclass ret; 
int startline1; 
yardlineclass startline; 
int numplays=0; 
int numpens=0; 
ftbteam t; 
ftbteam dt; 
int drivegain=0; 
driveendclass d2; 
boolean driveended=false; 
int maxplaysperdrive=40; 
footballtime ftbtime; 
 
playclass play[]=new playclass[maxplaysperdrive]; 
 
/*method*/ String drivestartstring() { 
String z=t.abbrev+" start at "+startline.ydline2(); 
if (t.dir==-1) {z="       "+z;} 
return z; 
} /*end drivestartstring*/ 
 
/*method*/ String driveenddescription() { 
String z="  "+(numplays-numpens)+" plays, "+ 
drivegain+" yards, "; 
if (fscore.recordtimestats) { 
z+=" (t: "+ftbtime.footballclock(ftbtime.timeofdrive)+ 
"  end: "+ftbtime.clocktime+")";} 
z+="  result:"+d2.endstring+"  "+t.abbrev; 
return z; 
} /*end driveendstring*/ 
 
 
/*method*/ String drivesummstring() { 
String z=drivestartstring()+"  "+driveenddescription(); 
return z; 
} /*end drivesummstring*/ 
 
/*constructor method*/ public driveclass( 
     ftbteam t, ftbteam dt, int startline1, returnclass ret) { 
   this.t=t;  this.dt=dt; 
   this.startline1=startline1; 
   this.startline=new yardlineclass(startline1); 
   this.ret=ret; 
   if (ret!=null) {fscore.playbyplaylist.additem("     "+ret.description()); 
   ret.updatestats();} 
   try { 
   fscore.numdrives++; 
   fscore.drives[fscore.numdrives]=this; 
      } catch (Exception ex) { 
                 mbox mb1=new mbox(fscore.fscoreframe, 
"Maximum of "+fscore.fscoreframe.maxdrivespergame+" drives per game exceeded"); 
                       mb1.setVisible(true); 
                             } 
   fscore.drivelist.additem(drivestartstring()); 
   driveended=false; 
   playclass p=new playclass(t, dt, 1, 10, startline1, fscore.quarter); 
   p.totrushyds=t.totrushyds; 
   p.totpassyds=t.totpassyds; 
   addplay(p); 
 
 }/*end constructor method*/ 
 
/*method*/ void driveend(driveendclass d2)  { 
   this.d2=d2; 
   int currentquarter=fscore.quarter; 
    String clockstring=""; 
   if (fscore.recordtimestats) { 
      if (d2 instanceof eoh) { 
                       clockstring="0:00"; 
                       currentquarter--; 
                            } 
      else { 
      ftbinbox in1=new ftbinbox(fscore.fscoreframe, 
      "Enter time on clock at end of drive",t,false); 
      in1.setVisible(true); 
      clockstring=in1.msgtext.getText(); 
           } 
      int prevdrivestarttime; 
      if (fscore.numdrives==1) {prevdrivestarttime=0;} 
         else {prevdrivestarttime= 
         fscore.drives[fscore.numdrives-1].ftbtime.driveendtime; 
               } 
      ftbtime=new footballtime(clockstring,fscore.quarter, 
            prevdrivestarttime); 
      }  /*end if record time stats*/ 
 
   d2.updatestats(); 
   if (d2.descriptionincluded) {fscore.playbyplaylist.concat(d2.description());} 
   fscore.playbyplaylist.additem(drivesummstring()); 
   fscore.drivelist.concat(driveenddescription()); 
   driveended=true; 
 
} /*end driveend 
 
/*method*/ void addplay(playclass p) { 
try{ 
   numplays++; 
   play[numplays]=p; 
} catch (Exception ex) { 
mbox mb1=new mbox(fscore.fscoreframe, 
"maximum limit of "+maxplaysperdrive+" plays per drive exceeded"); 
mb1.setVisible(true); 
                        } 
 
} /*end addplay*/ 
 
 
} /* driveclass*/ 
  
  
*: 
  
import java.awt.* ; 
import java.awt.event.* ; 
 
public class  ftbinbox extends Dialog 
implements ActionListener   { 
 
   Button  okbtn; 
   Button cancelbutton; 
   TextField  msgtext;   TextField msgtext2; 
   int  playerid; 
   int  ydline; 
   int  ydline2; 
   ftbteam t; 
   boolean returnyardnumbers; 
   boolean oktocontinue=false; 
   Frame parentframe; 
 
/*constructor method*/ public  ftbinbox(Frame  parent, 
     String  label, ftbteam t, boolean returnyardnumbers) { 
 
   super (parent,label, true); 
    this.parentframe=parent; 
   setLayout(new  BorderLayout()); 
   Panel  buttonpanel = new Panel() ; 
   okbtn = new Button ("OK"); 
   okbtn.addActionListener(this) ; 
   buttonpanel.add (okbtn); 
   cancelbutton=new Button ("Cancel"); 
   cancelbutton.addActionListener(this); 
   buttonpanel.add(cancelbutton); 
   add ("South",buttonpanel); 
   msgtext = new TextField (20); 
   msgtext.setEditable (true); 
   msgtext.setForeground(Color.green); 
   msgtext.setBackground(Color.black); 
   msgtext.setText (" "); 
   add ("North",msgtext); 
   msgtext2=new TextField(20); 
   msgtext2.setEditable(false); 
   msgtext2.setText(" "); 
   add("Center",msgtext2); 
 
   this.t=t; 
   this.returnyardnumbers=returnyardnumbers; 
    setBounds(10,20,500,150); 
  } /*end public---*/ 
 
/*method*/ int processyardstring(String yardstring) { 
    int newydline=0; 
    String yardstringnumber=yardstring.substring(1); 
    int yardnumber=Integer.parseInt(yardstringnumber); 
    String teamid=yardstring.substring(0,1); 
    teamid=teamid.toUpperCase(); 
    if (teamid.equals(fscore.t1.abbrev)) 
         {newydline=yardnumber;} 
    else if (teamid.equals(fscore.t2.abbrev)) 
         {newydline=100-yardnumber;} 
    return newydline; 
    } /*end processyardstring*/ 
 
public void actionPerformed(ActionEvent  e) { 
String  btn= e.getActionCommand (); 
  oktocontinue=true; 
try { 
if  (btn.equals ("OK")) { 
    String x=msgtext.getText(); 
if (returnyardnumbers) { 
    x=cpj.dupblankrem(x); 
/*System.out.println("|"+x+"|");*/ 
    int L=x.indexOf(" "); 
    if (L>0) { 
    String playerstring=  x.substring(0,L); 
    String yardstring=x.substring(L+1); 
    int L2=yardstring.indexOf(" "); 
    if (L2<0) { 
       ydline=processyardstring(yardstring); 
              } 
     else {String yardstring1=yardstring.substring(0,L2); 
           ydline=processyardstring(yardstring1); 
           String yardstring2=yardstring.substring(L2+1); 
          /*    System.out.println("yardstring:  |"+yardstring1+"| |"+yardstring2+"|");*/ 
           ydline2=processyardstring(yardstring2); 
           } 
/*    System.out.println("playerstring: |"+playerstring+"| yardstring: |"+yardstring+"|");*/ 
    int playernum=Integer.parseInt(playerstring); 
  if (playernum!=0)  { 
       playerid=t.findplayernum(playernum,parentframe); 
        } else {playerid=0;}  /*0 is code for no player entered*/ 
    } /*end if L>0*/ 
   else {  /*only yard line entered, no player number*/ 
     ydline=processyardstring(x);} 
 
   } /*end if return yard numbers*/ 
    setVisible(false) ;   dispose(); 
   } /*end if OK button*/ 
 else {setVisible(false); dispose(); oktocontinue=false;} 
 
 
  } catch (Exception ex) 
   {setVisible(false); dispose(); oktocontinue=false;} 
 
} /*end actionPerformed*/ 
 
 
}  /*end ftbinbox*/ 
 
  
  
*: 
  
import java.awt.*; 
 
public class screenclass { 
 
private screenparam sp; 
 
int numelements=0; 
 
screenelement elem[] = new screenelement[10]; 
 
Font currentfont; 
 
 
/*constructor method*/ public screenclass(screenparam sp) { 
this.sp=sp; 
 
currentfont=new Font("sanserif",Font.PLAIN,14); 
} /*end screenclass*/ 
 
/*method*/ void setfont(Font f) { 
currentfont=f; 
} 
 
/*method*/ void drawscreen(Graphics g) { 
g.setColor(Color.lightGray); 
g.fillRect(1,1,1000,1000); 
g.setColor(Color.black); 
for (int i=1; i<=numelements; i++) { 
  screenelement cse=elem[i]; 
      /*cse stands for current screen element*/ 
   cse.draw(g,sp); 
 } /*end i loop*/ 
 
} /*end drawscreen*/ 
 
/*method*/ int addto(int x, int y) { 
/*add y to x, except make sure x stays strictly positive*/ 
int z=x+y; 
if (z<1) {z=1;} 
return z; 
} /*end addto*/ 
 
/*method*/ void scalescreen(int y) { 
sp.h=addto(sp.h,y);   sp.w=addto(sp.w,y); 
for (int i=1; i<=numelements; i++) { 
  screenelement cse=elem[i]; 
      /*cse stands for current screen element*/ 
        cse.rescalescreenelement(sp); 
 } /*end i loop*/ 
} /*end scalescreen*/ 
 
/*method*/ screenparam getscreenparam() { 
return sp; } 
 
 
 } /*end screenclass*/ 
 
  
  
*: 
  
import java.awt.*; 
import java.io.*; 
 
class screenelement { 
 
private int numitems=5; 
 
int selecteditem=0; 
 
int h2=20; 
int w2=30; 
 
int bor=3;  /*border spacing, in pixels*/ 
 
boolean verticalformat=true; 
boolean boxes=false; 
boolean hidden=false; 
private boolean scrollable=false; 
private int startitem=1; 
 
private String textlist[]= 
          {" "," "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," ", 
           " "," "," "," "," "," "," "," "," "," "," "}; 
 
 
int colstart; int rowstart; int colend; int rowend; 
int x1;  int y1;  /*starting coordinates in pixels*/ 
int w1;  int h1;  /*width and height in pixels*/ 
Color c;  Color bc;   Color ec=Color.black; /*edge color*/ 
Color hc=Color.white;  Color hbc=Color.blue; 
/*highlight color/ highlight background color*/ 
 
/*constructor method*/ public screenelement(int colstart, 
 int rowstart, int colend, int rowend,  screenparam sp) { 
 
this.colstart=colstart;  this.rowstart=rowstart; 
this.colend=colend;      this.rowend=rowend; 
 
this.x1=sp.lm+colstart*sp.w; 
this.y1=sp.tm+rowstart*sp.h; 
this.w1=sp.w*(colend-colstart+1); 
this.h1=sp.h*(rowend-rowstart+1); 
 
c=null;  bc=null; 
 
} /*end constructor*/ 
 
/*constructor method*/ public screenelement(int colstart, 
 int rowstart, int colend, int rowend,screenparam sp, Color c, Color bc) { 
 
this.colstart=colstart;  this.rowstart=rowstart; 
this.colend=colend;      this.rowend=rowend; 
 
this.x1=sp.lm+colstart*sp.w; 
this.y1=sp.tm+rowstart*sp.h; 
this.w1=sp.w*(colend-colstart+1); 
this.h1=sp.h*(rowend-rowstart+1); 
 
this.c=c;  this.bc=bc; 
 
/*System.out.println("in constructor:"+this.x1+","+this.y1+","+ 
this.w1+","+this.h1);*/ 
 
} /*end constructor*/ 
 
/*method*/ void addtoscreen(screenclass s) { 
s.numelements++; 
s.elem[s.numelements]=this; 
} /*end addelement*/ 
 
/*method*/ void resetstart() {startitem=1;} 
 
/*method*/ void rescalescreenelement(screenparam sp) { 
x1=sp.lm+colstart*sp.w; 
y1=sp.tm+rowstart*sp.h; 
w1=sp.w*(colend-colstart+1); 
h1=sp.h*(rowend-rowstart+1); 
} 
 
/*method*/ void draw(Graphics g, screenparam sp) { 
if (!hidden) { 
/*System.out.println("in screenelement draw:x1="+x1+" y1="+ 
y1+" w1="+w1+"  h1="+h1);*/ 
 
if (bc!=null) {g.setColor(ec); g.fillRect(x1,y1,w1+2,h1+2); 
               g.setColor(bc); g.fillRect(x1,y1,w1,h1); 
               g.setColor(c); } /*bc=background color*/ 
int j=1; 
if (verticalformat) { 
for (int i=startitem; i<=numitems; i++) { 
/*System.out.println("  in scelem:  "+i+" "+textlist[i]);*/ 
if (i!=selecteditem) { 
g.drawString(textlist[i],x1+bor,(y1+j*h2-bor));} 
else {Color c2=g.getColor(); 
      g.setColor(hbc); 
      g.fillRect(x1,(y1+(j-1)*h2),w1,h2); 
      g.setColor(hc); 
      g.drawString(textlist[i],x1+bor,(y1+j*h2-bor)); 
      g.setColor(c2);} 
j++; 
} /*end for loop*/ 
} /*end verticalformat*/ 
else { /*horizontal format*/ 
/*System.out.println("now drawing in horizontal format");*/ 
for (int i=startitem; i<=numitems; i++) { 
g.drawString(textlist[i],x1+bor+(i-1)*w2,y1+h2-bor); 
if (boxes) {g.drawRect((x1+(i-1)*w2),y1,w2,h2);} 
} /*end for loop*/ 
} /*end horizontal format*/ 
} /*end not hidden*/ 
} /*end draw*/ 
 
 
/*method*/ void mouseprocess(int x, int y) { 
/*System.out.println("in mouseprocess: x="+x+"  y="+y);*/ 
int newselecteditem=0; 
if (verticalformat) {newselecteditem=startitem+y/h2;} 
else {newselecteditem=startitem+x/w2;} 
if (scrollable) {if (startitem==newselecteditem) 
                       {startitem-=10; 
                        if (startitem<1) {startitem=1;} 
                        newselecteditem=0;} 
                 else {startitem=newselecteditem;} 
               } /*end if scrollable*/ 
    selecteditem=newselecteditem; 
 
/*System.out.println("selecteditem="+selecteditem);*/ 
} /*end mouseprocess*/ 
 
 
/*method*/ void additem(String x) { 
try { 
numitems++; 
textlist[numitems]=x; 
    } catch (Exception ex) { 
       System.out.println( 
        "limit of "+(numitems-1)+" for screen element exceeded"); 
        numitems--; 
   for (int i=1; i<=(numitems-1); i++) { 
        textlist[i]=textlist[i+1]; 
                                       } /*end for loop*/ 
        textlist[numitems]=x+""; 
                           } /*end catch*/ 
} /*end additem*/ 
 
/*method*/ void concat(String x) { 
textlist[numitems]+=x; 
} 
 
/*method*/ void concat(String x, int i) { 
try { 
if (i>numitems) {i=numitems;} 
textlist[i]+=x; 
    } catch (Exception ex) { } 
} 
 
/*method*/ int getnumitems() { 
return numitems; 
} 
 
/*method*/ void resetnumber() { 
numitems=0; 
} 
 
/*method*/ void setnumitems(int x) { 
numitems=x;} 
 
/*method*/ void additem(String x, int i) { 
try { 
if (i>numitems) {additem(x);} 
textlist[i]=x; 
  } catch (Exception ex) {} 
} 
 
/*method*/ String getitem(int i) { 
return textlist[i];} 
 
/*method*/ void writefile(DataOutput f2, int fw, boolean newline) { 
  /*fw stands for field width*/ 
try{ 
for (int i=1; i<=numitems; i++) { 
String z=textlist[i]; 
z=z+cpj.blanks(fw-z.length()); 
f2.writeBytes(z); 
if (newline) {f2.writeBytes("\r\n");} 
} /*end i loop*/ 
   } catch (Exception ex) {String err = ex.toString(); 
                               System.out.println(err);} 
 
 
} /*end writefile*/ 
 
/*method*/ void setscrollable(boolean b) {scrollable=b;} 
 
/*method*/ int getstartitem() {return startitem;} 
 
/*method*/ void synchstartitem(screenelement s) { 
startitem=s.getstartitem(); 
} /*end synchstartitem*/ 
 
} /*end screenelement*/ 
 
 
  
  
*: 
  
public class mfgreturnclass extends returnclass { 
 
/*constructor*/ public mfgreturnclass(int playerid, int gain, 
 boolean tdscored, int quarter, ftbteam t, ftbteam dt, String notestring) { 
 
 super(playerid, gain, tdscored, quarter,t, dt, notestring); 
} /*end returnclass*/ 
 
/*method*/ void updatestats() { 
} 
 
/*method*/ String description() { 
return t.abbrev+": "+t.player[playerid].name+" "+gain+ 
" missed field goal return  "+ 
notestring; 
 
} /*end description*/ 
 
} /*end mfgreturnclass*/ 
  
  
*: 
  
import java.awt.*; 
 
public class playclass { 
 
ftbteam t; /*offensive team*/ 
ftbteam dt; /*defensive team*/ 
int down; 
int ytg; /*yards to gain*/ 
int tddist=100; 
yardlineclass ydline1; 
int ydline; 
int ydlinebef=0; 
int ydlineaft=0; 
int quarter; 
int gain=0; 
int totrushyds=0; 
int totpassyds=0; 
scrimmageplayclass p1; 
boolean ispenalty=false; 
int chainendyardline=0; 
int chainstartyardline=0; 
 
/*method*/ String downinfo() { 
return (t.abbrev+" "+down+"-"+ytg+" "+ydline1.ydline2()+" "); 
} /*end downinfo*/ 
 
/*constructor method*/ public playclass 
(ftbteam t, ftbteam dt, int down, int ytg, int ydline0, int quarter) { 
this.t=t;   this.dt=dt; 
this.down=down; 
this.ydline1=new yardlineclass(ydline0); 
this.ydline=ydline0; 
this.quarter=quarter; 
if (t.dir==1) {tddist=100-ydline;} else {tddist=ydline;} 
if (ytg=ytg) {t.penaltyfirstdowns++;} 
 } else { /*not penalty*/ 
t.numdowns[down]++; 
if (gain>=ytg)  /*first down achived*/ 
    {t.convdowns[down]++; 
     if (playtype instanceof rushplayclass) {t.rushingfirstdowns++;} 
     if (playtype instanceof passplayclass) {t.passingfirstdowns++;} 
               } 
t.downyards[down]+=gain; 
     } /*not penalty*/ 
} /*end updatedownstats*/ 
 
 
/*method*/ playclass advanceball(int gain2, int rushpl, int passpl, int recpl, 
    fscore fscoreframe) { 
 
if (gain20) {p1 = new rushplayclass(t, rushpl, gain, tddist);} 
else if (passpl>0) {p1 = new passplayclass(t, passpl,recpl, gain, tddist);} 
 
/*check for confirmation before actually advancing the ball*/ 
String  playdescription=p1.description()+" to "+newydline0.ydline2()+"  "; 
if (gain>=tddist) {playdescription+=" TOUCHDOWN";} 
else { /*not touchdown*/ 
if (gain<=(tddist-100)) {playdescription+=" SAFETY";} 
else       { /*not TD or safety*/ 
if (gain>=ytg) {playdescription+="first down";} 
else { /*not TD, safety, or first down*/ 
if (newdown<=4) { 
playdescription+="next: Down: "+newdown+", yards to gain: "+(ytg-gain); 
                } 
else {playdescription+=" turn over on downs";} 
     } /*end not TD, safety, or first down*/ 
           } /*end not TD or safety*/ 
      } /*end not touchdown*/ 
 
confirmbox c1=new confirmbox(fscoreframe,playdescription); 
c1.setBounds(10,400,700,180); 
c1.setVisible(true); 
c1.notetext.requestFocus(); 
if (c1.oktocontinue) { 
 
p1.updatestats(); 
 
updatedownstats(p1); 
 
fscore.currdrive.drivegain+=gain; 
 
fscore.playbyplaylist.concat("  "+p1.description()+"; "+c1.notestring); 
 
playclass newplay=null; 
 
 
fscore.rushtable.selecteditem=0; 
fscore.passtable.selecteditem=0; 
fscore.rectable.selecteditem=0; 
 
 
 
if ((newydline>=100)|(newydline<=0)) { /*touchdown or safety*/ 
if ((newydline>=100)&(t.dir==1)) {fscore.addscore(t,dt,6,p1);} 
if ((newydline<=0)&(t.dir==-1)) {fscore.addscore(t,dt,6,p1);} 
if ((newydline>=100)&(t.dir==-1)) {fscore.addscore(dt,t,2,p1);} 
if ((newydline<=0)&(t.dir==1)) {fscore.addscore(dt,t,2,p1);} 
newplay=null;  /*dummy return*/ 
 
 
} /*end touchdown or safety*/ 
else { /*not touchdown or safety*/ 
if (gain>=ytg) { /*first down achieved*/ 
 
newplay=new playclass(t,dt,1,10,newydline,quarter); 
} /*end first down achieved*/ 
else { /*first down not achieved*/ 
if ((down<4)|(ispenalty))  { 
newplay=new playclass(t,dt,newdown,(ytg-gain),newydline,quarter); 
} /*end down<4)*/ 
else { /*was 4th down*/ 
if (!ispenalty) { 
fourdown fourdown1=new fourdown(t, dt); 
fscore.currdrive.driveend(fourdown1); 
fscore.currdrive=new driveclass(dt, t, newydline, null); 
newplay=fscore.currdrive.play[1]; 
} /*not penalty*/ 
 
 
} /*end was 4th down*/ 
} /*end else first down not achieved*/ 
} /*end else not touchdown or safety*/ 
 
if (newplay!=null) {fscore.currdrive.addplay(newplay); 
newplay.totrushyds=totrushyds; 
newplay.totpassyds=totpassyds; 
} /*end not null*/ 
return newplay; 
   } /*end if ok to continue*/ 
else {gain=0; return this;} 
} /*end advanceball*/ 
 
/*method*/ int totyds() {return (totrushyds+totpassyds);} 
 
 
/*method*/ diagramparameters fielddiagram 
(ftbfield ftf, int prevdir, int row, int oldrowoffset, boolean isnewdrive) { 
int rowoffset=0; 
int direction=0; 
int rowadvance=0; 
 

if (gain>0) {rowadvance=0;}
        else {rowadvance=1;}


diagramparameters dpm=null; 
Color lc=Color.black; 
if (fscore.reversedirection) {ydlinebef=100-ydline; 
                              ydlineaft=100-(ydline+gain*t.dir);} 
                              else {ydlinebef=ydline; 
                                    ydlineaft=ydline+gain*t.dir;} 
 lc=t.linecolor; 
dpm=new diagramparameters( 
ftf.x1+(ydlinebef*fscore.sp.w/5),  /*x1 coordinate of line*/ 
ftf.y1+ftf.rowspacing*(row+rowoffset),  /*y1 coordinate of line*/ 
ftf.x1+(ydlineaft*fscore.sp.w/5),  /*x2 coordinate of line*/ 
ftf.y1+ftf.rowspacing*(row+rowadvance+rowoffset),  /*y2 coordinate of line*/ 
lc, /*color*/ 
row+rowoffset, 
rowoffset, 
rowadvance, 
direction, 
1  /*linestyle always 1 for now*/ 
); 
 
return dpm; 
} /*end fielddiagram*/ 
 
} /*end playclass*/ 
 
 
  
  
*: 
  
import java.awt.*; 
 
public class ftbfield extends screenelement { 
 
static int rowspacing=7;  static int startdrive=1; 
 
/*constructor method*/ public ftbfield( 
  int colstart, int rowstart, int colend, int rowend, 
  screenparam sp) { 
super(colstart,rowstart,colend,rowend,sp); 
 
} /*end constructor*/ 
 
/*method*/ void draw(Graphics g, screenparam sp) { 
 
Color greenfield=new Color(160,255,160);  /*light green*/ 
g.setColor(greenfield); 
g.fillRect(x1,y1,w1,h1); 
g.setColor(Color.white); 
g.drawRect(x1,y1,w1,h1); 
for (int i=1; i<=19; i++) {  /*draw yard lines*/ 
g.drawLine(x1+i*sp.w, y1, x1+i*sp.w, y1+h1); 
/*g.drawString((""+(5*i)),x1+i*sp.w,y1+5);*/ 
} /*end loop*/ 
 
Color leftcolor=fscore.t1.linecolor; 
Color rightcolor=fscore.t2.linecolor; 
 
if (fscore.reversedirection) {leftcolor=fscore.t2.linecolor; 
                             rightcolor=fscore.t1.linecolor;} 
 
/*draw yard line numbers*/ 
 
g.setColor(leftcolor); 
 
if (fscore.reversedirection) {g.drawString(fscore.t2.teamname,x1,y1);} 
                       else {g.drawString(fscore.t1.teamname,x1,y1);} 
 
 
for (int i=1; i<=9; i++) { 
 
if (i==5) {g.setColor(Color.black);} 
else {if (i>=6) {g.setColor(rightcolor);}} 
int k=0; 
if (i<=5) {k=10*i;} else {k=100-10*i;} 
g.drawString(""+k, x1+2*i*sp.w-5, y1); 
} 
 
if (fscore.reversedirection) 
     {g.drawString(fscore.t1.teamname,x1+19*sp.w-5,y1);} 
    else {g.drawString(fscore.t2.teamname,x1+19*sp.w-5,y1);} 
 
playclass p=null; 
diagramparameters dp1=null; 
 
int diagramrow=1;   int prevdir=0;  int oldrowoffset=0; 
 
 
try { 
for (int i2=startdrive; i2<=fscore.numdrives; i2++) { 
driveclass drive1=fscore.drives[i2]; 
if (drive1.numplays==0) { /*return TD, or EOH*/ 
diagramrow++; 
if (drive1.d2.endstring.equals("TD")) { 
int x2=0; 
if (fscore.reversedirection) { 
if (drive1.startline1==0) {x2=x1+19*sp.w;} else {x2=x1;} 
                            } else { 
if (drive1.startline1==0) {x2=x1;} else {x2=x1+19*sp.w;} 
                               } 
 
 
int y2=y1+diagramrow*rowspacing; 
g.drawString("return TD",x2,y2); 
} /*end if td*/ 
} /*end numplays==0*/ 
else { 
diagramrow++;  /*1/21/2006*/
for (int i=1; i<=drive1.numplays; i++) { 
String enddrivecode2=" "; 
if (drive1.play[i]!=null) { 
p=drive1.play[i]; 
dp1=p.fielddiagram(this,prevdir,diagramrow,0,(i==1));   /*was old row offset*/
                                  /*if i==1, then isnewdrive will be true*/ 
oldrowoffset=dp1.rowoffset;   
diagramrow+=dp1.rowadvance+dp1.rowoffset;  /*1/21/2006*/
if (drive1.driveended) { 
if (i==drive1.numplays){ 
enddrivecode2=drive1.d2.endstring;}} 
g.setColor(dp1.c); 
/*g.setColor(Color.blue);*/ 
/*System.out.println("ftb:i:"+i+"drawing lines:"+dp1.x1+" "+dp1.y1+" "+dp1.x2+"  "+dp1.y2);*/ 
/*System.out.println("            ydline="+p.ydline+" gain="+p.gain);*/ 
g.drawLine(dp1.x1,dp1.y1,dp1.x2,dp1.y2); 
if (p.down==1) { int dy=2; 
                if (p.gain==0) {dy=4;} else {dy=2;} 
                g.setColor(Color.white); 
                g.fillOval(dp1.x1-2,dp1.y1-dy,4,4); 
                g.setColor(Color.black); 
                g.drawOval(dp1.x1-2,dp1.y1-dy,4,4); 
                g.setColor(Color.blue); 
                 } 
else {g.fillOval(dp1.x1-2,dp1.y1-2,4,4);} 
g.setColor(Color.black); 
g.drawString(enddrivecode2, dp1.x2, dp1.y1-1); 
if (enddrivecode2.equals("FG")) { 
    int goalline=x1; 
       if (drive1.play[1].dt==fscore.t2) {goalline=x1+20*sp.w;} 
       if (fscore.reversedirection) {goalline=(2*x1+20*sp.w)-goalline;} 
g.drawString("FG",goalline, dp1.y1-1); 
      g.setColor(dp1.c); 
      int fgstart=0;  int fgend=0; 
      if (goalline=yl) {return " "+cpj.cf((yg-yl),3)+" ";} 
                               else {return "("+cpj.cf((yg-yl),3)+")";} 
                        } /*end net*/ 
 
/*method*/ String ravg() {return avgcalc((yg-yl),tcb,1);} 
int rtd;  /*rushing touchdowns*/ 
 
/*heading:"TCB  YG YL Net   Avg TD"*/ 
 
 
/*method*/ String rushstring() { 
    return (cpj.cf(tcb,3)+cpj.cf(yg,4)+ 
    cpj.cf(yl,3)+net()+ravg()+cpj.cf(rtd,3)); 
  } 
 
/*passing stats*/ 
int pa; /*pass attempts*/ 
int pc; /*pass completed*/ 
int hi; /*had intercepted*/ 
int pyds; /*passing yards*/ 
/*method*/ String pavg() {return avgcalc(pyds,pa,1);} 
/*method*/ String comppct() 
  {if (pa==0) {return  "  ...";} 
  else {if (pa==pc) {return "1.000";} 
  else {if (pc==0) { return " .000";} 
  else { 
  int pct=((10000*pc/pa)+5)/10; 
  if (pct>100) {return " ."+cpj.cf(pct,3);} 
           else {return " .0"+cpj.cf(pct,2);} 
        } 
      } 
     } 
    } /*end comppct*/ 
 
int ptd; /*passing touchdowns*/ 
 
/*heading:"PA PC HI  Yds   Avg   Pct  TD"*/ 
 
/*method*/ String passstring() { 
  return (cpj.cf(pa,2)+cpj.cf(pc,3)+ 
    cpj.cf(hi,3)+cpj.cf(pyds,5)+" "+pavg()+" "+comppct()+ 
    cpj.cf(ptd,4)); 
} 
 
/*receiving stats*/ 
int rec; /*receptions*/ 
int rcyds; /*receiving yards*/ 
/*method*/ String rcavg() {return avgcalc(rcyds,rec,1);} 
int rctd; /*receiving tds*/ 
 
/*method*/ String recstring() { 
 return (cpj.cf(rec,3)+cpj.cf(rcyds,5)+"  "+rcavg()+cpj.cf(rctd,4)); 
} 
 
 
/*punting stats*/ 
int punts; 
int puntyds; 
/*method*/ String puntavg() {return avgcalc(puntyds,punts,1);} 
 
/*punt return stats*/ 
int puntrets; 
int puntretyds; 
/*method*/ String puntretavg() {return avgcalc(puntretyds,puntrets,1);} 
 
/*interception return stats*/ 
int interceptions; 
int intretyds; 
/*method*/ String intretavg() {return avgcalc(intretyds,interceptions,1);} 
 
/*kickoff return stats*/ 
int kickrets; 
int kickretyds; 
/*method*/ String kickretavg() {return avgcalc(kickretyds,kickrets,1);} 
 
/*method*/ void setzero() { 
tcb=0; yg=0; yl=0; rtd=0; 
pa=0;  pc=0;  hi=0;  pyds=0;  ptd=0; 
rec=0;  rcyds=0; rctd=0; 
punts=0;  puntyds=0; 
puntrets=0;  puntretyds=0; 
interceptions=0;  intretyds=0; 
kickrets=0;  kickretyds=0; 
} /*end setzero*/ 
 
/*constructor method*/ public statclass() { 
this.setzero(); 
 
} /*end constructor method*/ 
 
 
/*method*/ static statclass addstats(statclass s1, statclass s2) { 
statclass tot=new statclass(); 
    /*rushing stats*/ 
tot.tcb=s1.tcb+s2.tcb; 
tot.yg=s1.yg+s2.yg; 
tot.yl=s1.yl+s2.yl; 
tot.rtd=s1.rtd+s2.rtd; 
 
   /*passing stats*/ 
tot.pa=s1.pa+s2.pa; 
tot.pc=s1.pc+s2.pc; 
tot.hi=s1.hi+s2.hi; 
tot.pyds=s1.pyds+s2.pyds; 
tot.ptd=s1.ptd+s2.ptd; 
 
   /*receiving stats*/ 
tot.rec=s1.rec+s2.rec; 
tot.rcyds=s1.rcyds+s2.rcyds; 
tot.rctd=s1.rctd+s2.rctd; 
 
   /*punting, interceptions, and return stats*/ 
tot.punts=s1.punts+s2.punts; 
tot.puntyds=s1.puntyds+s2.puntyds; 
tot.interceptions=s1.interceptions+s2.interceptions; 
tot.intretyds=s1.intretyds+s2.intretyds; 
tot.puntrets=s1.puntrets+s2.puntrets; 
tot.puntretyds=s1.puntretyds+s2.puntretyds; 
tot.kickrets=s1.kickrets+s2.kickrets; 
tot.kickretyds=s1.kickretyds+s2.kickretyds; 
 
return tot; 
} /*end addstats*/ 
 
} /*end statclass*/ 
  
  
*: 
  
import java.awt.*; 
 
public class ftbteam { 
String teamname; 
String abbrev; 
int score; 
int maxplayer=0;   /*number of players actually in list*/ 
int maxplayer2=120;  /*maximum number of players that could fit in array*/ 
int dir;  /*direction*/ 
playerclass player[]=new playerclass[maxplayer2]; 
statclass teamstat=new statclass(); 
Color linecolor; 
int totrushyds=0;  int totpassyds=0; 
 




int rushlist[]={0,1,2,3,4,5,6,7,8}; 
int passlist[]={0,1,2,3}; 
int reclist[]={0,4,5,6,7,8,9,10,11}; 
int kicker=1; 
int punter=1; 
 
int qscore[]={0,0,0,0,0,0}; 
 
int drivelist[]={0,0,0,0,0,0,0,0,0,0,0,0}; 
 
int numdowns[]={0,0,0,0,0}; 
int convdowns[]={0,0,0,0,0}; 
int downyards[]={0,0,0,0,0}; 
 
/*method*/ String gainperdown(int down) { 
 return statclass.avgcalc(downyards[down],numdowns[down],1); 
 } 
 
 
int rushingfirstdowns=0; 
int passingfirstdowns=0; 
int penaltyfirstdowns=0; 
 
 
 
int penalties=0; 
int penaltyyards=0; 
int numsacks=0; 
int sackyards=0; 
int fumblesnotlost=0; 
 
 
/*constructor method*/ public ftbteam 
 (String teamname, String abbrev, int dir, Color linecolor, 
    Color passplaycolor) { 
this.teamname=teamname; 
this.abbrev=abbrev; 
this.dir=dir; 
this.score=0; 
this.linecolor=linecolor; 
 
} /*end constructor method*/ 
 
 
/*method*/ public void addplayer(String name, int number, String position) { 
playerclass p=new playerclass(name,number,position); 
maxplayer++; 
player[maxplayer]=p; 
} /*end addplayer*/ 
 
/*method*/ int findposition(int startpos, String x) { 
int i=startpos; 
boolean found=false; 
/*System.out.println("in find position: i="+i);*/ 
while ((i=maxplayer) {continue1=false;} 
          } /*end while loop*/ 
    if (found) {playerid=i;}  /*else add new player*/ 
     else { /*add new player*/ 
      boolean needplayerinfo=true; 
    while (needplayerinfo) { 
    String x0=" "; 
    ftbinbox ftbin2=new 
    ftbinbox(frame2,"Enter player #, position and name (e.g: 30 RB Smith)", 
                 this,false); 
              ftbin2.msgtext.setText(" "+playernum+" "); 
              ftbin2.setVisible(true); 
              try { 
              x0=ftbin2.msgtext.getText(); 
              String x2=x0; 
              x2=cpj.dupblankrem(x2); 
              int L9=x2.indexOf(" "); 
              String playernumbers=x2.substring(0,L9); 
              x2=x2.substring(L9+1); 
              int playernumber=Integer.parseInt(playernumbers); 
              L9=x2.indexOf(" "); 
              String playerposition=x2.substring(0,L9); 
              String playername=x2.substring(L9+1); 
              confirmbox c2=new confirmbox(frame2, 
              "Player: "+playername+"  Number: "+playernumber+ 
                 "  Position: "+playerposition); 
              c2.notetext.setText(" "); 
              c2.notetext.setEditable(false); 
              c2.setVisible(true); 
              if (c2.oktocontinue) { 
              addplayer(playername,playernumber,playerposition); 
              playerid=maxplayer; 
              needplayerinfo=false; 
                                   } 
               } catch (Exception ex) { 
                  mbox mbox1=new mbox(frame2,"invalid input: "+x0); 
                  mbox1.setVisible(true); 
                  playerid=0; 
                                      } 
           } /*end while*/ 
         } /*end add new player*/ 
   return playerid; 
} /*end playernum*/ 
 
/*method*/ int findname(String nam) { 
    int playerid=0; 
    int i=0; 
    boolean found=false; 
    boolean continue1=true; 
    while(continue1) { 
      i++; 
      if (nam.equals(player[i].name)) {found=true; 
                                          continue1=false;} 
      if (i>=maxplayer) {continue1=false;} 
          } /*end while loop*/ 
    if (found) {playerid=i;} 
           else {playerid=-1;} 
   return playerid; 
} /*end findname*/ 
 
 
} /*end ftbteam*/ 
  
  
*: 
  
public class playerclass { 
String name; 
String name12; /*always 12 characters*/ 
int number; 
statclass stat; /*statistics to be displayed*/ 
statclass prevstat; /*cumulative statistics from previous games*/ 
statclass tstat;  /*totatl stats: previous+current game*/ 
String position; 
 
/*constructor method*/ public playerclass 
 (String name, int number, String position) { 
this.name=name; this.number=number; 
this.position=position; 
stat=new statclass(); 
prevstat=new statclass(); 
tstat=new statclass(); 
if (name.length()<12) 
    {name12=name+blank(12-name.length());} 
else { if (name.length()>12) 
    {name12=name.substring(0,12);} 
      else {name12=name;} 
      } 
} /*end constructor method*/ 
 
/*method*/ String blank(int n) { 
try{ 
String b="                                            "; 
return b.substring(0,n); 
} catch (Exception ex) {return " ";} 
} /* end string*/ 
 
/*method*/ void setseasontotals() { 
tstat.setzero(); 
tstat=statclass.addstats(prevstat,stat); 
} /*end setseasontotals*/ 
 
} /*end player*/ 
  
  
*: 
  
import  java .awt.*; 
import  java .awt.event.*; 
import  java .awt.datatransfer.*; 
import  java .io.*; 
import  java .util.*; 
import  java .text.*; 
public  class  fscore extends Frame  
implements MouseListener  {   
public  static  fscore fscoreframe; 
  
 
static Font font1= new Font("sanserif",Font.PLAIN,14); 
static Font font2= new Font("monospaced",Font.PLAIN,14); 
 
static int state=0; 
static int quarter=1; 
static Color c=Color.black;   /*text color*/ 
static Color bc=new Color(200,200,200); /*background color*/ 
static Color forecol=Color.black; /*alternative text color*/ 
static Color backcol=Color.white;  /*alternative background color*/ 
static Color darkGreen=new Color(0,125,0); /*dark green*/ 
static Color orangered=new Color(200,100,50); 
/***static screenparam sp=new screenparam(10,80,28,20);***/ 
/**This is the constructor method for screenparam: 
public  screenparam(int  lm, int  tm, int  w, int  h, Font f0) 
where lm=left margin, tm=top margin, w=width, h=height, f0=font); 
  **/ 

static int maxrusher=7;
static int maxpasser=2;
static int maxreceiver=6; 
static int maxyarditems=19;

static screenparam sp=new screenparam(10,80,45,24,font1);  /*width was 35*/
static int rownum=1; 
static screenclass gamescreen=new screenclass(sp); 
static screenclass scorescreen=new screenclass(sp); 
static screenparam sp1a=new screenparam(10,80,35,24,font2); 
static screenclass statscreen=new screenclass(sp1a); 
static screenclass teamstatscreen=new screenclass(sp1a); 
static screenparam sp2=new screenparam(10,20,40,20,font1); 
 
static screenclass rosterscreen=new screenclass(sp2); 
static screenclass playbyplayscreen=new screenclass(sp); 
static screenclass drivesummscreen=new screenclass(sp); 
static screenclass fullscreenview=new screenclass(sp); 
static screenclass cs=gamescreen; 
 
 
static ftbteam t1=new ftbteam("Visitor","V",1,Color.red,orangered); 
static ftbteam t2=new ftbteam("Home","H",-1,Color.blue,Color.magenta); 
 
/*This is the constructor method for screenelement: 
public screenelement(int colstart, int rowstart, 
int colend, int rowend,  screenparam sp) {  */ 
 
static screenelement scoreboard1= new screenelement(1,10,5,16,sp,Color.black,Color.white); 
static screenelement rushtable=new screenelement( 7,10,11,(10+maxrusher),sp,Color.black,Color.white); 
static screenelement passtable=new screenelement(13,10,19,(10+maxpasser),sp,Color.black,Color.white); 
static screenelement rectable=new screenelement(13,(12+maxpasser),17,
                                            (12+maxpasser+maxreceiver),sp,Color.black,Color.white); 
static screenelement yardtable=new screenelement(1,(15+maxrusher),19,(15+maxrusher),sp,Color.white,darkGreen); 
static screenelement yardtable2=new screenelement(1,(16+maxrusher),19,(16+maxrusher),sp,darkGreen,Color.white); 
static int yardtablestart=-4; 
static playclass currplay =null;/*new playclass(t1,t2,1,10,30,1);*/ 
static driveclass currdrive=null; 
static playclass tempplay=null; 
static int rushplayer; 
static int passplayer; 
static int recplayer; 
static String x1; /*used for file input*/ 
 
static screenelement qscore1=new screenelement(1,1,6,1,sp,forecol,backcol); 
static screenelement qscore2=new screenelement(1,2,6,2,sp,forecol,backcol); 
static screenelement qscore3=new screenelement(1,3,6,3,sp,forecol,backcol); 
static screenelement scorelist=new screenelement(1,4,12,25,sp,forecol,backcol); 
 
static screenelement playbyplaylist=new screenelement(1,1,20,25,sp,forecol,backcol); 
 
/*This is the constructor method for screenelement: 
public screenelement(int colstart, int rowstart, 
int colend, int rowend,  screenparam sp) {  */ 
 
 
static screenelement team1names=new screenelement(1,1,3,25,sp,forecol,backcol); 
static screenelement team1stats=new screenelement(4,1,10,25,sp,forecol,backcol); 
static screenelement team2names=new screenelement(12,1,14,25,sp,forecol,backcol); 
static screenelement team2stats=new screenelement(15,1,21,25,sp,forecol,backcol); 
 
static screenelement teamstats=new screenelement(1,1,20,20,sp,forecol,backcol); 
 
static screenelement team1roster=new screenelement(1,1,9,25,sp,forecol,backcol); 
static screenelement team2roster=new screenelement(11,1,18,25,sp,forecol,backcol); 
 
static screenelement drivesumm1=new screenelement(1,1,10,1,sp,forecol,backcol); 
static screenelement drivesumm2=new screenelement(1,2,10,2,sp,forecol,backcol); 
static screenelement drivesumm3=new screenelement(1,3,10,3,sp,forecol,backcol); 
static screenelement drivelist=new screenelement(1,4,16,25,sp,forecol,backcol); 
 
static boolean reversedirection=false; 
 
static int numdrives=0; 
static int maxdrivespergame=150; 
static driveclass drives[]=new driveclass[maxdrivespergame]; 
 
static boolean gamestarted=false; 
static boolean hometeamset=false; 
static boolean visitingteamset=false; 
private static boolean needkickoff=true; 
static boolean recordtimestats=true; 
 
 
/*method*/ void scalescreens(int x) { 
 /*This method can be used to make the screen elements larger 
 or smaller; this is helpful because people will be using different 
 monitors*/ 
System.out.println("in scalescreens:"+x); 
gamescreen.scalescreen(x); 
scorescreen.scalescreen(x); 
statscreen.scalescreen(x); 
teamstatscreen.scalescreen(x); 
rosterscreen.scalescreen(x); 
playbyplayscreen.scalescreen(x); 
drivesummscreen.scalescreen(x); 
fullscreenview.scalescreen(x); 
} /*end scalescreens*/ 
 
/*method*/ String readname() { 
     /*reads and modifies global string variable x1*/ 
  x1=x1.trim()+" "; 
  int L=x1.indexOf(" "); 
  String z=x1.substring(0,L); 
  /*System.out.println("0) {statmode=1;  x1=f1.readLine();} 
   if (L2>0) {statmode=2;  x1=f1.readLine();} 
   if (L3>0) {statmode=3;  x1=f1.readLine();} 
   if (L4>0) {statmode=4;  x1=f1.readLine();} 
   if (L5>0) {statmode=5;  x1=f1.readLine();} 
   if (L6>0) {statmode=6;  x1=f1.readLine();} 
   if (L7>0) {statmode=7;  x1=f1.readLine();} 
 
   x1=x1.trim(); 
  x1=cpj.replacestring(x1,". ","."); 
/*System.out.println("x1: |"+x1+"|  statmode="+statmode);*/ 
 if (x1!=null) { 
 
if (statmode==1) { /*rushing stats*/ 
   String pname=readname(); 
   int playerid=t.findname(pname); 
        /* System.out.println("playerid="+playerid);*/ 
   if (playerid>0) { 
   statclass s=t.player[playerid].prevstat; 
   s.tcb=readint(); 
   s.yg=readint(); 
   s.yl=0; 
   String xignore=readname(); 
   xignore=readname(); 
   s.rtd=readint(); 
                  } 
} /*end rushing stats*/ 
 
if (statmode==2) { /*receiving stats*/ 
   String pname=readname(); 
   int playerid=t.findname(pname); 
   if (playerid>0) { 
   statclass s=t.player[playerid].prevstat; 
   s.rec=readint(); 
   s.rcyds=readint(); 
   String xignore=readname(); 
   xignore=readname(); 
   s.rctd=readint(); 
                    } 
} /*end receiving stats*/ 
 
if (statmode==3) { /*interceptions*/ 
   String pname=readname(); 
   int playerid=t.findname(pname); 
   if (playerid>0) { 
   statclass s=t.player[playerid].prevstat; 
   s.interceptions=readint(); 
   s.intretyds=readint(); 
                   } 
} /*end interceptions*/ 
 
 
if (statmode==4) { /*punting*/ 
   String pname=readname(); 
   int playerid=t.findname(pname); 
   if (playerid>0) { 
   statclass s=t.player[playerid].prevstat; 
   s.punts=readint(); 
   s.puntyds=readint(); 
                   } 
} /*end punting*/ 
 
if (statmode==5) { /*punt returns*/ 
   String pname=readname(); 
   int playerid=t.findname(pname); 
   if (playerid>0) { 
   statclass s=t.player[playerid].prevstat; 
   s.puntrets=readint(); 
   String xignore=readname(); 
   s.puntretyds=readint(); 
                  } 
} /*end punt returns*/ 
 
if (statmode==6) { /*kick returns*/ 
   String pname=readname(); 
   int playerid=t.findname(pname); 
   if (playerid>0) { 
   statclass s=t.player[playerid].prevstat; 
   s.kickrets=readint(); 
   s.kickretyds=readint(); 
                    } 
} /*end kick returns*/ 
 
if (statmode==7) { /*passing*/ 
   String pname=readname(); 
   int playerid=t.findname(pname); 
   if (playerid>0) { 
   statclass s=t.player[playerid].prevstat; 
   s.pa=readint(); 
   s.pc=readint(); 
   s.pyds=readint(); 
   String xignore=readname(); 
   xignore=readname(); 
   s.ptd=readint(); 
   x1=f1.readLine(); 
                   } 
} /*end passing*/ 
 
  } /*x1 !=null*/ 
 
    x1=f1.readLine(); 
} /*end while*/ 
 
} catch (Exception ex) { 
       String errstring=ex.toString(); 
       System.out.println(errstring); } 
 
} /*end loadseasonstats*/ 
 
/*method*/ boolean setteam(ftbteam t, String homeorvisitor) { 
FileDialog fd=new FileDialog(fscoreframe, 
("Select "+homeorvisitor+" Team file"),FileDialog.LOAD); 
fd.setFile("*.team"); 
fd.setVisible(true); 
String filename=fd.getFile(); 
/*System.out.println("filename:"+filename);*/ 
try { 
DataInput f1=new DataInputStream(new FileInputStream(filename)); 
t.teamname=f1.readLine().trim(); /*the first line of a team file contains 
                             the team name*/ 
/*System.out.println("team name:"+t.teamname);*/ 
t.abbrev=f1.readLine(); /*the second line of a team file contains the 
                             one-letter team abbreviation*/ 
 
t.abbrev=t.abbrev.substring(0,1); 
/*System.out.println("abbreviation:"+t.abbrev);*/ 
t.maxplayer=0; 
String textline=f1.readLine(); 
while (textline!=null) { 
   /*the remaining lines in a team file consist of a player name, 
      comma, player number, comma, player position abbreviation: 
       QB=quarterback, RB=running back, WR=wide receiver, TE=tight end, 
        K=kicker, P=punter, etc*/ 
 
try { 
int commalocation=textline.indexOf(","); 
String playername=textline.substring(0,commalocation); 
textline=textline.substring(commalocation+1); 
commalocation=textline.indexOf(","); 
String playernumberstring=textline.substring(0,commalocation).trim(); 
/*System.out.print("playernumber="+playernumberstring);*/ 
int playernumber=Integer.parseInt(playernumberstring); 
 
String positionabbreviation=textline.substring(commalocation+1).trim(); 
/*System.out.println("abbrev="+positionabbreviation);*/ 
t.maxplayer++; 
t.player[t.maxplayer]= 
    new playerclass(playername,playernumber,positionabbreviation); 
     } catch(Exception ex) { 
        /*ignore line if it is invalid*/ } 
textline=f1.readLine(); 
/*System.out.println("input line: |"+textline+"|");*/ 
} /*end while*/ 
 
t.kicker=t.findposition(1,"K"); 
t.punter=t.findposition(1,"P"); 
 
/*System.out.println("after set kicker:"+t.kicker+"   punter:"+t.punter);*/ 
setrushlist(t); 
 
setpasslist(t); 
setreclist(t); 
 
loadseasonstats(t); 
 
return true; 
} catch(Exception ex) {String err=ex.toString(); 
                       System.out.println(err); 
                       return false;} 
 
} /*end setteam*/ 
 
/*method*/ void setvisitingteam() { 
if (setteam(fscoreframe.t1,"Visiting")) { 
fscoreframe.m11.setEnabled(false); 
fscoreframe.visitingteamset=true;} 
} 
 
/*method*/ void sethometeam() { 
if (setteam(fscoreframe.t2,"Home")) { 
fscoreframe.m12.setEnabled(false); 
fscoreframe.hometeamset=true;} 
} 
 
 
 
/*method*/ void setrushlist(ftbteam t) { 
int i=0; int j=1; 
while ((i<=maxrusher)&(j<=t.maxplayer)) { 
  if /*(*/   (t.player[j].position.equals("RB"))   /*| 
      (t.player[j].position.equals("QB")))*/  { 
       i++; 
       t.rushlist[i]=j; 
       } 
  j++; 
 } /*while*/ 
} /*end setrushlist*/ 
 
/*method*/ void setpasslist(ftbteam t) { 
int i=0; int j=1; 
while ((i<=maxpasser)&(j<=t.maxplayer)) { 
  if (t.player[j].position.equals("QB"))  { 
       i++; 
       t.passlist[i]=j; 
       } 
  j++; 
 } /*while*/ 
} /*end setpasslist*/ 
 
/*method*/ void setreclist(ftbteam t) { 
int i=0; int j=1; 
while ((i<=maxreceiver)&(j<=t.maxplayer)) { 
  if ((t.player[j].position.equals("WR")) | 
      (t.player[j].position.equals("TE")))  { 
       i++; 
       t.reclist[i]=j; 
       } 
  j++; 
 } /*while*/ 
} /*end setreclist*/ 
 
 
/*method*/ static String pluralcheck(int x, String y) { 
if (Math.abs(x)==1) {return (""+x+" "+y);} 
else {return(""+x+" "+y+"s");} 
} 
 
/*method*/ static void updategame() { 
 
 
String dstringlist[]={" ","1st","2nd","3rd","4th"}; 
 
 
scoreboard1.setnumitems(7); 
/*System.out.println("in updategame: t1.score="+t1.score+"  t2.score="+t2.score);*/ 
scoreboard1.additem(t1.teamname+" "+t1.score+"  "+t2.teamname+" "+t2.score,1); 
if (state>0){ 
if (currplay!=null) { 
scoreboard1.additem("Down: "+currplay.down+"  YTG:"+currplay.ytg,2); 
scoreboard1.additem(currplay.t.teamname+" ball at "+currplay.ydline1.ydline2(),3); 
scoreboard1.additem(""+dstringlist[currplay.down]+": "+ 
currplay.t.convdowns[currplay.down]+"-"+currplay.t.numdowns[currplay.down]+ 
"  avg gain:"+currplay.t.gainperdown(currplay.down),5); 
int driveplays2=currdrive.numplays-1-currdrive.numpens; 
/*System.out.println("numplays:"+currdrive.numplays+"  pens:"+currdrive.numpens);*/ 
if (currdrive.driveended) {driveplays2++;} 
scoreboard1.additem("Drive: "+pluralcheck((driveplays2),"play")+", "+ 
       pluralcheck(currdrive.drivegain," yard"),6); 
 
scoreboard1.additem(currplay.t.abbrev+":"+currplay.t.totrushyds+ 
   " rush+"+currplay.t.totpassyds+" pass="+ 
     (currplay.t.totrushyds+currplay.t.totpassyds),7); 
            } 
            } 
else {scoreboard1.additem(" ",2); scoreboard1.additem(" ",3); 
      scoreboard1.additem(" ",5); scoreboard1.additem(" ",6); 
      scoreboard1.additem(" ",7);} 
 
scoreboard1.additem("Quarter: "+quarter,4); 
 
if (state==0) {rushtable.hidden=true; passtable.hidden=true; 
               rectable.hidden=true;} 
else { 
rushtable.hidden=false; passtable.hidden=false; 
               rectable.hidden=false; 
 
rushtable.resetnumber(); 
rushtable.additem("RUSHING"); 
 
playerclass p; 
 
for (int i=1; i<=fscore.maxrusher; i++) { 
p=currplay.t.player[currplay.t.rushlist[i]]; 
rushtable.additem(p.name+"  "+p.stat.tcb+"-"+p.stat.net()); 
} 
 
passtable.resetnumber(); 
passtable.additem("PASSING"); 
 
for (int i=1; i<=fscore.maxpasser; i++) { 
p=currplay.t.player[currplay.t.passlist[i]]; 
passtable.additem(p.name+"  "+p.stat.pc+"-"+p.stat.pa+" ("+p.stat.hi+ 
"int) "+p.stat.pyds+"yds"); 
} 
 
rectable.resetnumber(); 
rectable.additem("RECEIVING"); 
for (int i=1; i<=fscore.maxreceiver; i++) { 
p=currplay.t.player[currplay.t.reclist[i]]; 
rectable.additem(p.name+"  "+p.stat.rec+"-"+p.stat.rcyds); 
} 
} /*end else*/ 
 
if (state==1) {yardtable.hidden=true; yardtable2.hidden=true; 
                         yardtablestart=-4;} 
else { 
yardtable.hidden=false; 
yardtable2.hidden=false; 
yardtable.resetnumber(); 
yardtable2.resetnumber(); 
int yardtablevalue=yardtablestart; 
yardtable.additem("<--"); 
yardtable2.additem("  "); 
int yardtable2start=currplay.t.dir*yardtablestart+currplay.ydline- 
                    currplay.t.dir; 
int yardline2=yardtable2start; 

for (int i=1; i<=fscore.maxyarditems; i++){ 
String yd=String.valueOf(yardtablevalue); 
yardtable.additem(" "+yd); 
yardline2+=currplay.t.dir; 
int yardline3=yardline2; 
if (yardline2>50) {yardline3=100-yardline2;} 
String yd2=" "; 
if (yardline3>=0) {yd2=String.valueOf(yardline3);} 
yardtable2.additem(" "+yd2); 
 
yardtablevalue++; 
 
} /*end for loop*/ 
yardtable.additem("-->"); 
} /*end else*/ 
 
} /*end updategame*/ 
 
 
 
/*method*/ void offpenalty(int yds) { 
/*System.out.println("offense penalty yards:"+yds);*/ 
currplay=currplay.advanceball(-yds,-1,0,0,fscoreframe); 
currdrive.numpens++; 
} /*end offpenalty*/ 
 
/*method*/ void defpenalty(int yds) { 
/*System.out.println("defense penalty yards:"+yds);*/ 
currplay=currplay.advanceball(yds,-1,0,0,fscoreframe); 
currdrive.numpens++; 
} /*end defpenalty*/ 
 
/*method*/ void addpenalty(ftbteam t, int yds, boolean askforconfirmation) { 
  /*this method is only used with penalties on kickoffs or punts*/ 
if (askforconfirmation) { 
confirmbox c1=new confirmbox(fscoreframe," "+yds+"yard penalty on "+t.teamname); 
c1.setVisible(true); 
if (c1.oktocontinue) { 
   t.penalties++; 
   t.penaltyyards+=Math.abs(yds); 
   playbyplaylist.additem(yds+"yard penalty on "+t.teamname+"; "+c1.notestring); 
   } /*end if oktocontinue*/ 
} /*end if askforconfirmation*/ 
} /*end addpenalty*/ 
 
 
/*method*/ public static void addscore(ftbteam t, ftbteam dt, int points, 
scrimmageplayclass p1) { 
fscore.setneedkickoff(true); 
t.score+=points; 
/*System.out.println("in addscore: "+fscore.t1.score+"-"+fscore.t2.score);*/ 
t.qscore[quarter]+=points; 
String scorestring=" "; 
String conversionstring=""; 
 
ftbinbox in1; 
 
if (points==6) {  /*conversion*/ 
touchdown td=new touchdown(t,dt); 
currdrive.driveend(td); 
 
 
in1=new ftbinbox(fscoreframe,"TOUCHDOWN! Enter conversion information",currplay.t,false); 
in1.msgtext.setText(t.player[t.kicker].name+" kick"); 
in1.msgtext2.setText(p1.description()+"   "+t.teamname+" "+t.score+"    "+ 
           dt.teamname+" "+dt.score); 
in1.setVisible(true); 
conversionstring=in1.msgtext.getText().trim(); 
int L0=conversionstring.indexOf("efense"); /*very rare:defensive 2 point conversion*/ 
if (L0>0) {dt.score+=2; dt.qscore[quarter]+=2;} 
else { 
int L=conversionstring.indexOf("failed"); 
if (L<0) {  /*conversion succeeded because "failed" did not occur*/ 
int L2=conversionstring.indexOf("kick"); 
if (L2>0) {t.score+=1;  t.qscore[quarter]+=1;} 
     else {t.score+=2;  t.qscore[quarter]+=2;} 
      } 
} 
 
fscoreframe.repaint(); 
} /*end conversion*/ 
 
String pointstring=" "; 
if (currplay.t.score>=currplay.dt.score) 
 {pointstring="     "+currplay.t.abbrev+" "+currplay.t.score+"   "+ 
         currplay.dt.abbrev+" "+currplay.dt.score;} 
else 
 {pointstring="     "+currplay.dt.abbrev+" "+currplay.dt.score+"   "+ 
         currplay.t.abbrev+" "+currplay.t.score;} 
 
if (points==6) { /*start td, part 2*/ 
 
playbyplaylist.concat("***TD  "+pointstring); 
scorestring=t.abbrev+" "+p1.description()+"  ("+conversionstring+")  "+ 
         pointstring; 
 
 
} /*end touchdown*/ 
 
if (points==3) { /*field goal*/ 
scorestring=currplay.t.abbrev+" "+p1.description()+" "+pointstring; 
} /*end field goal*/ 
 
if (points==2) { /*safety*/ 
in1=new ftbinbox(fscoreframe,"Enter safety description",t,false); 
in1.msgtext.setText(" safety, "); 
in1.setVisible(true); 
scorestring=currplay.dt.abbrev+" "+in1.msgtext.getText()+"  "+pointstring; 
safety safe1=new safety(t,dt); 
currdrive.driveend(safe1); 
 
              } /*end safety*/ 
 
scorelist.additem(scorestring); 
/**scorelist.textlist[scorelist.numitems]=scorestring;**/ 
/*System.out.println(scorestring);*/ 
 
 
} /*end addscore*/ 
 
 
/*method*/ void kickreturn(ftbteam t, ftbteam dt) { 
boolean tdscored=false; 
ftbinbox in1; 
in1=new ftbinbox(fscoreframe, 
"Enter return player, yard line at start, yard line at end (or 20 for touchback)", 
t,true); 
in1.msgtext2.setText(t.teamname+" receives kickoff"); 
in1.setVisible(true); 
if (in1.oktocontinue) { 
if (in1.playerid==0) { /*no return*/ 
   confirmbox c1 = 
    new confirmbox(fscoreframe,"no kickoff return; ball starts at 20"); 
    c1.setVisible(true); 
   if (c1.oktocontinue) { 
   int startingyardline=20; 
   if (t.dir==-1) {startingyardline=80;} 
   currdrive=new driveclass(t,dt,startingyardline,null); 
   currplay=currdrive.play[1]; 
   fscore.setneedkickoff(false); 
                        } 
             }  /*end if no return*/ 
else {  /*there was a kickoff return*/ 
int returnlength=t.dir*(in1.ydline2-in1.ydline); 
int newydline3=returnyardlinecalc(t,in1.ydline2); 
String finalyardlinestring=""; 
if ((newydline3<=0)||(newydline3>=100)) { 
      finalyardlinestring="TOUCHDOWN";} 
else { 
yardlineclass newyd=new yardlineclass(newydline3); 
    finalyardlinestring=" to "+newyd.ydline2(); 
      } 
   confirmbox c1 = 
    new confirmbox(fscoreframe,(t.player[in1.playerid].name+" "+ 
        returnlength+" yard return; "+finalyardlinestring)); 
     c1.setVisible(true); 
   if (c1.oktocontinue) { 
 
kickreturnclass kr1=new kickreturnclass(in1.playerid, returnlength, 
 false, quarter, t, dt, c1.notestring); 
    currdrive=new driveclass(t, dt, newydline3, kr1); 
    currplay=currdrive.play[1]; 
if ((newydline3>=100)|(newydline3<=0)) 
  { returntd(t,dt,in1.playerid,returnlength,"kickoff"); 
      tdscored=true;} 
  if (!tdscored) { 
  fscore.setneedkickoff(false); 
      } /*end if not tdscored*/ 
    } /*end if c1.oktocontinue*/ 
     } /*end return*/ 
 } /*end if in1.oktocontinue*/ 
} /*end kickreturn*/ 
 
 
/*method*/ static void updatescore() { 
qscore1.verticalformat=false; 
qscore2.verticalformat=false; 
qscore3.verticalformat=false; 
 
qscore1.resetnumber();  qscore2.resetnumber();  qscore3.resetnumber(); 
 
qscore1.additem(" "); 
qscore2.additem(t1.abbrev); 
qscore3.additem(t2.abbrev); 
 
for (int i=1; i<=5; i++) { 
qscore1.additem(cpj.cf(i,2)); 
qscore2.additem(cpj.cf(t1.qscore[i],2)); 
qscore3.additem(cpj.cf(t2.qscore[i],2)); 
} 
 
qscore1.additem("Tot"); 
qscore2.additem(cpj.cf(t1.score,2)); 
qscore3.additem(cpj.cf(t2.score,2)); 
 
} /*end update score*/ 
 
/*method*/ static void addline(screenelement s, String x) { 
s.additem(x); 
} /*end addline*/ 
 
/*method*/ static void updaterosters(ftbteam t, screenelement sn) { 
sn.resetnumber(); 
addline(sn,t.teamname); 
for (int i=1; i<=t.maxplayer; i++) { 
addline(sn,t.player[i].number+"  "+t.player[i].position+"  "+ 
       t.player[i].name); 
} /*end for loop*/ 
} /*end updaterosters*/ 
 
 
 
/*method*/ static void updatestats(ftbteam t, 
 screenelement sn, screenelement s, int stattype) { 
sn.resetnumber(); 
s.resetnumber(); 
 
addline(sn," "); 
addline(s,t.teamname); 
 
 
if (stattype==2) { 
for (int i=1; i<=t.maxplayer; i++) { 
      t.player[i].setseasontotals(); 
                                    } 
                  } 
 
addline(sn,"RUSHING     "); 
addline(s,"TCB  YG YL Net   Avg TD"); 
statclass totals=new statclass(); 
int numrushers=0; 
for (int i=1; i<=t.maxplayer; i++) { 
statclass st =t.player[i].stat; 
if (stattype==2) {st=t.player[i].tstat;} 
if (st.tcb>0) { 
    numrushers++; 
    addline(sn,t.player[i].name12); 
    addline(s,st.rushstring()); 
    totals.tcb+=st.tcb; totals.yg+=st.yg; totals.yl+=st.yl; 
    totals.rtd+=st.rtd; 
    } 
} /*end for*/ 
   if (numrushers>1) { 
          addline(sn,"TOTAL       "); 
          addline(s,totals.rushstring()); 
                      } 
 
addline(sn," "); addline(s," "); 
 
addline(sn,"PASSING     "); 
addline(s,"PA PC HI  Yds   Avg   Pct  TD"); 
for (int i=1; i<=t.maxplayer; i++) { 
statclass st =t.player[i].stat; 
if (stattype==2) {st=t.player[i].tstat;} 
if (st.pa>0) { 
    addline(sn,t.player[i].name12); 
    addline(s,st.passstring()); 
    } 
} /*end for*/ 
 
addline(sn," "); addline(s," "); 
 
addline(sn,"RECEIVING   "); 
addline(s,"Rec  Yds    Avg  TD"); 
int numreceivers=0; 
for (int i=1; i<=t.maxplayer; i++) { 
statclass st =t.player[i].stat; 
if (stattype==2) {st=t.player[i].tstat;} 
if (st.rec>0) { 
   numreceivers++; 
   addline(sn,t.player[i].name12); 
   addline(s,st.recstring()); 
   totals.rec+=st.rec; totals.rcyds+=st.rcyds; 
   totals.rctd+=st.rctd; 
    } 
} /*end for*/ 
if (numreceivers>1) {addline(sn,"TOTAL       "); 
                     addline(s,totals.recstring()); 
                     } 
 
addline(sn," "); addline(s," "); 
 
addline(sn,"PUNTING     "); 
addline(s,"Punts Yds   Avg "); 
for (int i=1; i<=t.maxplayer; i++) { 
statclass st =t.player[i].stat; 
if (stattype==2) {st=t.player[i].tstat;} 
if (st.punts>0) { 
addline(sn,t.player[i].name12); 
addline(s,cpj.cf(st.punts,3)+ 
cpj.cf(st.puntyds,6)+" "+st.puntavg());} 
} /*end for*/ 
 
/*addline(sn," "); addline(s," ");*/ 
 
/*punt return stats*/ 
addline(sn,"P.RETURNS   "); 
addline(s,"PuntRets Yds  Avg"); 
 
for (int i=1; i<=t.maxplayer; i++) { 
statclass st =t.player[i].stat; 
if (stattype==2) {st=t.player[i].tstat;} 
if (st.puntrets>0) { 
addline(sn,t.player[i].name12); 
addline(s,cpj.cf(st.puntrets,4)+ 
cpj.cf(st.puntretyds,8)+st.puntretavg());} 
} /*end for*/ 
 
addline(sn," "); addline(s," "); 
 
addline(sn,"INTERCEPTS  "); 
addline(s,"Int Yds   Avg"); 
for (int i=1; i<=t.maxplayer; i++) { 
statclass st =t.player[i].stat; 
if (stattype==2) {st=t.player[i].tstat;} 
if (st.interceptions>0) { 
addline(sn,t.player[i].name12); 
addline(s,cpj.cf(st.interceptions,3)+ 
cpj.cf(st.intretyds,4)+" "+st.intretavg());} 
} /*end for*/ 
 
 
addline(sn," "); addline(s," "); 
 
/*kickoff return stats*/ 
 
addline(sn,"KICK RETURNS"); 
addline(s,"Num Yds   Avg "); 
for (int i=1; i<=t.maxplayer; i++) { 
statclass st =t.player[i].stat; 
if (stattype==2) {st=t.player[i].tstat;} 
if (st.kickrets>0) { 
addline(sn,t.player[i].name12); 
addline(s,cpj.cf(st.kickrets,3)+ 
cpj.cf(st.kickretyds,4)+" "+st.kickretavg());} 
} /*end for*/ 
 
 
} /*end updatestats*/ 
 
/*method*/ void updateteamstats(ftbteam t1, ftbteam t2, screenelement s) { 
s.resetnumber(); 
 
addline(s,"Team Statistics"); 
 
addline(s,t1.teamname+"  "+t1.totrushyds+ 
   " rush +  "+t1.totpassyds+" pass=  "+(t1.totrushyds+t1.totpassyds)+" total yards"); 
addline(s,t2.teamname+"  "+t2.totrushyds+ 
   " rush +  "+t2.totpassyds+" pass=  "+(t2.totrushyds+t2.totpassyds)+" total yards"); 
 
int t1plays=0; int t2plays=0; 
 
for (int down=1; down<=4; down++) { 
addline(s," "+down+" down: "+t1.teamname+"  "+ 
t1.convdowns[down]+"-"+t1.numdowns[down]+" avg.gain: "+ 
t1.gainperdown(down)+"     "+down+" down: "+ 
t2.teamname+"  "+ 
t2.convdowns[down]+"-"+t2.numdowns[down]+" avg.gain: "+ 
t2.gainperdown(down)); 
t1plays+=t1.numdowns[down];  t2plays+=t2.numdowns[down]; 
} 
 
addline(s,t1.teamname+" Total Plays:"+t1plays+"  Avg gain:"+ 
cpj.nf(((double)(t1.totrushyds+t1.totpassyds)/t1plays),6,2)); 
addline(s,t2.teamname+" Total Plays:"+t2plays+"  Avg gain:"+ 
cpj.nf(((double)(t2.totrushyds+t2.totpassyds)/t2plays),6,2)); 
 
 
addline(s," "); 
addline(s,"First Downs"); 
addline(s,t1.teamname+" Rushing: "+t1.rushingfirstdowns+",     Passing: " 
+t1.passingfirstdowns+",     Penalty: "+t1.penaltyfirstdowns+ 
",       Total: "+t1.totalfirstdowns()); 
 
addline(s,t2.teamname+" Rushing: "+t2.rushingfirstdowns+",     Passing: " 
+t2.passingfirstdowns+",     Penalty: "+t2.penaltyfirstdowns+ 
",      Total: "+t2.totalfirstdowns()); 
 
addline(s," "); 
addline(s,"Turnovers:"); 
addline(s,t1.teamname+" Fumbles lost:"+t1.drivelist[7]+"  Interceptions:" 
+t1.drivelist[6]+"  Total:"+(t1.drivelist[6]+t1.drivelist[7])); 
 
addline(s,t2.teamname+" Fumbles lost:"+t2.drivelist[7]+"  Interceptions:" 
+t2.drivelist[6]+"  Total:"+(t2.drivelist[6]+t2.drivelist[7])); 
addline(s,"Total fumbles: "+t1.teamname+" "+(t1.drivelist[7]+t1.fumblesnotlost)+ 
                  "    "+t2.teamname+" "+(t2.drivelist[7]+t2.fumblesnotlost)); 
 
addline(s," "); 
addline(s,t1.teamname+"  "+t1.penalties+" penalties, "+ 
   t1.penaltyyards+" yards     "+t2.teamname+" "+t2.penalties+ 
   " penalties, "+t2.penaltyyards+" yards"); 
addline(s,t1.teamname+": sacked "+t1.numsacks+" times and lost "+ 
   t1.sackyards+" yards       "+t2.teamname+": sacked "+t2.numsacks+ 
   " times and lost "+t2.sackyards+" yards"); 
 
if (fscore.recordtimestats) { 
   driveclass dr=null; 
   int top1=0;  int top2=0;  /*time of possession*/ 
   for (int i=1; i<=fscore.numdrives; i++) { 
    dr=fscore.drives[i]; 
     if (dr.driveended) { 
    if (dr.t==t1) {top1+=dr.ftbtime.timeofdrive;} 
            else {top2+=dr.ftbtime.timeofdrive;} 
/*System.out.println("drive:"+i+"  top1:"+top1+"  top2:"+top2);*/ 
                     } /*end if driveended*/ 
   } /*end i loop*/ 
   dr=fscore.drives[fscore.numdrives]; 
addline(s,"Time of possession: "+t1.teamname+" "+ 
footballtime.footballclock(top1)+ 
  "     "+t2.teamname+" "+footballtime.footballclock(top2)); 
  } /*end if recordtimestats*/ 
} /*end updateteamstats*/ 
 
 
 
/*method*/ void updatedrivesumm() { 
String codelist[]={" ","TD","FG","mFG","Punt","4D","Int","Fum","Saf","EOH"}; 
 
drivesumm1.verticalformat=false; 
drivesumm1.resetnumber(); 
drivesumm2.verticalformat=false; 
drivesumm2.resetnumber(); 
drivesumm3.verticalformat=false; 
drivesumm3.resetnumber(); 
drivesumm1.additem(" "); 
drivesumm2.additem(t1.abbrev); 
drivesumm3.additem(t2.abbrev); 
 
for (int i=1; i<=9; i++) { 
drivesumm1.additem(codelist[i]); 
drivesumm2.additem(cpj.cf(t1.drivelist[i],2)); 
drivesumm3.additem(cpj.cf(t2.drivelist[i],2)); 
} /*end for loop*/ 
 
} /*end updatedrivesumm*/ 
 
/*method*/ void returntd(ftbteam t, ftbteam dt, 
 int playerid, int gain, String returntype) { 
currdrive.numplays=0; 
returntdclass rtd1=new returntdclass(t,playerid,gain, 
returntype); 
addscore(t,dt,6,rtd1); 
 
} /*end returntd*/ 
 
/*method*/ int returnyardlinecalc(ftbteam t, int y) { 
int z=y; 
if (z>=100) {if (t.dir==-1) {z=80;}} 
if (z<=0) {if (t.dir==1) {z=20;}} 
return z; 
} 
 
/*method*/ void writetotextfile(String fn) { 
updatescore(); 
updatedrivesumm(); 
try{ 
DataOutput f2 = new  DataOutputStream (new  FileOutputStream (fn)); 
if (t1.score>t2.score) 
{f2.writeBytes(t1.teamname+" "+t1.score+" "+t2.teamname+" "+t2.score+" \r\n");} 
else {f2.writeBytes(t2.teamname+" "+t2.score+" "+t1.teamname+" "+t1.score+" \r\n");} 
 
Date now=new Date(); 
f2.writeBytes(" "+now+ "\r\n"); 
 
  /*in writefile, first argument is the outputfile; 
     second argument is the field width in characters; 
      third argument is true if each item will appear on a new line in 
         the output file*/ 
qscore1.writefile(f2,8,false); 
f2.writeBytes(" \r\n"); 
qscore2.writefile(f2,8,false); 
f2.writeBytes(" \r\n"); 
qscore3.writefile(f2,8,false); 
f2.writeBytes(" \r\n"); 
f2.writeBytes(" \r\n"); 
scorelist.writefile(f2,50,true); 
f2.writeBytes(" \r\n"); 
 
f2.writeBytes("Drive summary \r\n"); 
 
drivesumm1.writefile(f2,8,false); 
f2.writeBytes(" \r\n"); 
drivesumm2.writefile(f2,8,false); 
f2.writeBytes(" \r\n"); 
drivesumm3.writefile(f2,8,false); 
f2.writeBytes(" \r\n"); 
drivelist.writefile(f2,50,true); 
 
 
 
f2.writeBytes(" \r\n"); 
updateteamstats(t1,t2,teamstats); 
teamstats.writefile(f2,50,true); 
 
f2.writeBytes(" \r\n"); 
 
updatestats(t1,team1names,team1stats,1); 
f2.writeBytes(" \r\n"); 
for (int i=1; i<=team1stats.getnumitems(); i++) { 
f2.writeBytes(team1names.getitem(i)+"  "+team1stats.getitem(i)+" \r\n"); 
} 
 
updatestats(t2,team2names,team2stats,1); 
f2.writeBytes(" \r\n"); 
for (int i=1; i<=team2stats.getnumitems(); i++) { 
f2.writeBytes(team2names.getitem(i)+"  "+team2stats.getitem(i)+" \r\n"); 
} 
 
f2.writeBytes(" \r\n"); 
f2.writeBytes("Play by Play \r\n"); 
playbyplaylist.writefile(f2,50,true); 
   } catch (Exception  ex) {String  err = ex.toString() ; 
                               System.out.println (err);} 
} /*end writetotextfile*/ 
 
 
/*method*/ static void setneedkickoff(boolean b) { 
needkickoff=b; 
} 
 
 
  
/*constructor*/ 
public  fscore(String  title) { 
super(title); 
 } /*end constructor*/ 
  
public  void  init()  { 
setBackground(bc); 
 
font1=new Font("sanserif",Font.PLAIN,14); 
font2=new Font("monospaced",Font.BOLD,14); 
 
 
 
scoreboard1.addtoscreen(gamescreen); 
rushtable.addtoscreen(gamescreen); 
passtable.addtoscreen(gamescreen); 
rectable.addtoscreen(gamescreen); 
yardtable.verticalformat=false; 
yardtable2.verticalformat=false; 
yardtable.boxes=true; 
yardtable2.boxes=true; 
yardtable.hidden=true; 
yardtable2.hidden=true; 
yardtable.addtoscreen(gamescreen); 
yardtable2.addtoscreen(gamescreen); 
ftbfield ftf =new ftbfield(1,2,20,8,sp); 
ftf.addtoscreen(gamescreen); 
ftbfield ftf2=new ftbfield(1,2,20,30,sp); 
ftf2.addtoscreen(fullscreenview); 
 
 
qscore1.addtoscreen(scorescreen); 
qscore2.addtoscreen(scorescreen); 
qscore3.addtoscreen(scorescreen); 
 
playbyplaylist.addtoscreen(playbyplayscreen); 
playbyplaylist.resetnumber(); 
playbyplaylist.setscrollable(true); 
playbyplaylist.additem("FIRST QUARTER"); 
 
team1names.addtoscreen(statscreen); 
team1stats.addtoscreen(statscreen); 
team2names.addtoscreen(statscreen); 
team2stats.addtoscreen(statscreen); 
 
team1names.setscrollable(true); 
team1stats.setscrollable(true); 
team2names.setscrollable(true); 
team2stats.setscrollable(true); 
 
teamstats.addtoscreen(teamstatscreen); 
 
scorelist.resetnumber(); 
scorelist.addtoscreen(scorescreen); 
scorelist.setscrollable(true); 
 
drivesumm1.addtoscreen(drivesummscreen); 
drivesumm2.addtoscreen(drivesummscreen); 
drivesumm3.addtoscreen(drivesummscreen); 
drivelist.resetnumber(); 
drivelist.addtoscreen(drivesummscreen); 
drivelist.setscrollable(true); 
 
team1roster.addtoscreen(rosterscreen); 
team2roster.addtoscreen(rosterscreen); 
 
team1roster.setscrollable(true); 
team2roster.setscrollable(true); 
 
scorelist.additem("FIRST QUARTER"); 
 
Panel  upperpanel = new  Panel (); 
Panel  lowerpanel = new  Panel (); 
add(BorderLayout .NORTH,upperpanel); 
add(BorderLayout .SOUTH,lowerpanel); 
MenuBar m0 = new  MenuBar();  
/*Menu*/ m1= new  Menu("File");  
 /*MenuItem*/ m11 = new  MenuItem("LoadVisitingTeam");  
  m11.addActionListener (new m11lis());   
 m1.add (m11);  
 /*MenuItem*/ m12 = new  MenuItem("LoadHomeTeam");  
  m12.addActionListener (new m12lis());   
 m1.add (m12);  
 /*MenuItem*/ m13 = new  MenuItem("CreateTeamFile");  
  m13.addActionListener (new m13lis());   
 m1.add (m13);  
 /*MenuItem*/ m14 = new  MenuItem("SaveGameTextFile");  
  m14.addActionListener (new m14lis());   
 m1.add (m14);  
 /*MenuItem*/ m15 = new  MenuItem("Exit");  
  m15.addActionListener (new m15lis());   
 m1.add (m15);  
m0.add (m1);  
   
/*Menu*/ m2= new  Menu("Edit");  
/*Menu*/ m21= new  Menu("ChangeHomeTeamColor");  
  /*MenuItem*/ m211 = new  MenuItem("StandardColors_");  
   m211.addActionListener (new m211lis());   
  m21.add (m211);  
  /*MenuItem*/ m212 = new  MenuItem("CustomColors_");  
   m212.addActionListener (new m212lis());   
  m21.add (m212);  
 m2.add (m21);  
/*Menu*/ m22= new  Menu("ChangeVisitingTeamColor");  
  /*MenuItem*/ m221 = new  MenuItem("StandardColors");  
   m221.addActionListener (new m221lis());   
  m22.add (m221);  
  /*MenuItem*/ m222 = new  MenuItem("CustomColors");  
   m222.addActionListener (new m222lis());   
  m22.add (m222);  
 m2.add (m22);  
 /*MenuItem*/ m23 = new  MenuItem("StopRecordingTimeOfPossession");  
  m23.addActionListener (new m23lis());   
 m2.add (m23);  
/*Menu*/ m24= new  Menu("Correct down,distance,or yard line");  
/*Menu*/ m241= new  Menu("Correct down");  
   /*MenuItem*/ m2411 = new  MenuItem("1st down");  
    m2411.addActionListener (new m2411lis());   
   m241.add (m2411);  
   /*MenuItem*/ m2412 = new  MenuItem("2nd down");  
    m2412.addActionListener (new m2412lis());   
   m241.add (m2412);  
   /*MenuItem*/ m2413 = new  MenuItem("3rd down");  
    m2413.addActionListener (new m2413lis());   
   m241.add (m2413);  
   /*MenuItem*/ m2414 = new  MenuItem("4th down");  
    m2414.addActionListener (new m2414lis());   
   m241.add (m2414);  
  m24.add (m241);  
/*Menu*/ m242= new  Menu("Correct distance to first down");  
   /*MenuItem*/ m2421 = new  MenuItem("Add one yard");  
    m2421.addActionListener (new m2421lis());   
   m242.add (m2421);  
   /*MenuItem*/ m2422 = new  MenuItem("Subtract one yard");  
    m2422.addActionListener (new m2422lis());   
   m242.add (m2422);  
   /*MenuItem*/ m2423 = new  MenuItem("Add five yards");  
    m2423.addActionListener (new m2423lis());   
   m242.add (m2423);  
   /*MenuItem*/ m2424 = new  MenuItem("Subtract five yards");  
    m2424.addActionListener (new m2424lis());   
   m242.add (m2424);  
  m24.add (m242);  
/*Menu*/ m243= new  Menu("Correct yard line");  
   /*MenuItem*/ m2431 = new  MenuItem("Forward one yard");  
    m2431.addActionListener (new m2431lis());   
   m243.add (m2431);  
   /*MenuItem*/ m2432 = new  MenuItem("Backward one yard");  
    m2432.addActionListener (new m2432lis());   
   m243.add (m2432);  
   /*MenuItem*/ m2433 = new  MenuItem("Forward five yards");  
    m2433.addActionListener (new m2433lis());   
   m243.add (m2433);  
   /*MenuItem*/ m2434 = new  MenuItem("Backward five yards");  
    m2434.addActionListener (new m2434lis());   
   m243.add (m2434);  
  m24.add (m243);  
 m2.add (m24);  
m0.add (m2);  
   
/*Menu*/ m3= new  Menu("View");  
 /*MenuItem*/ m31 = new  MenuItem("GameAction");  
  m31.addActionListener (new m31lis());   
 m3.add (m31);  
 /*MenuItem*/ m32 = new  MenuItem("Scoring");  
  m32.addActionListener (new m32lis());   
 m3.add (m32);  
 /*MenuItem*/ m33 = new  MenuItem("GameStatistics");  
  m33.addActionListener (new m33lis());   
 m3.add (m33);  
 /*MenuItem*/ m34 = new  MenuItem("SeasonStatistics");  
  m34.addActionListener (new m34lis());   
 m3.add (m34);  
 /*MenuItem*/ m35 = new  MenuItem("TeamStatistics");  
  m35.addActionListener (new m35lis());   
 m3.add (m35);  
 /*MenuItem*/ m36 = new  MenuItem("Rosters");  
  m36.addActionListener (new m36lis());   
 m3.add (m36);  
 /*MenuItem*/ m37 = new  MenuItem("PlaybyPlay");  
  m37.addActionListener (new m37lis());   
 m3.add (m37);  
 /*MenuItem*/ m38 = new  MenuItem("DriveSummary");  
  m38.addActionListener (new m38lis());   
 m3.add (m38);  
 /*MenuItem*/ m39 = new  MenuItem("FullScreenDiagram");  
  m39.addActionListener (new m39lis());   
 m3.add (m39);  
 /*MenuItem*/ m310 = new  MenuItem("ReverseDirection");  
  m310.addActionListener (new m310lis());   
 m3.add (m310);  
/*Menu*/ m311= new  Menu("AdjustDiagram");  
  /*MenuItem*/ m3111 = new  MenuItem("SlideUp");  
   m3111.addActionListener (new m3111lis());   
  m311.add (m3111);  
  /*MenuItem*/ m3112 = new  MenuItem("SlideUp5");  
   m3112.addActionListener (new m3112lis());   
  m311.add (m3112);  
  /*MenuItem*/ m3113 = new  MenuItem("SlideDown");  
   m3113.addActionListener (new m3113lis());   
  m311.add (m3113);  
  /*MenuItem*/ m3114 = new  MenuItem("SlideDown5");  
   m3114.addActionListener (new m3114lis());   
  m311.add (m3114);  
  /*MenuItem*/ m3115 = new  MenuItem("IncreaseSeparation");  
   m3115.addActionListener (new m3115lis());   
  m311.add (m3115);  
  /*MenuItem*/ m3116 = new  MenuItem("IncreaseSeparation5");  
   m3116.addActionListener (new m3116lis());   
  m311.add (m3116);  
  /*MenuItem*/ m3117 = new  MenuItem("DecreaseSeparation");  
   m3117.addActionListener (new m3117lis());   
  m311.add (m3117);  
  /*MenuItem*/ m3118 = new  MenuItem("DecreaseSeparation5");  
   m3118.addActionListener (new m3118lis());   
  m311.add (m3118);  
 m3.add (m311);  
m0.add (m3);  
   
/*Menu*/ m4= new  Menu("Play");  
 /*MenuItem*/ m41 = new  MenuItem("Rushing");  
  m41.addActionListener (new m41lis());   
 m4.add (m41);  
 /*MenuItem*/ m42 = new  MenuItem("Passing");  
  m42.addActionListener (new m42lis());   
 m4.add (m42);  
 /*MenuItem*/ m43 = new  MenuItem("NewPasser");  
  m43.addActionListener (new m43lis());   
 m4.add (m43);  
 /*MenuItem*/ m44 = new  MenuItem("Punt");  
  m44.addActionListener (new m44lis());   
 m4.add (m44);  
 /*MenuItem*/ m45 = new  MenuItem("Interception");  
  m45.addActionListener (new m45lis());   
 m4.add (m45);  
 /*MenuItem*/ m46 = new  MenuItem("Lost Fumble");  
  m46.addActionListener (new m46lis());   
 m4.add (m46);  
 /*MenuItem*/ m47 = new  MenuItem("Fumble (not lost)");  
  m47.addActionListener (new m47lis());   
 m4.add (m47);  
 /*MenuItem*/ m48 = new  MenuItem("Sack");  
  m48.addActionListener (new m48lis());   
 m4.add (m48);  
/*Menu*/ m49= new  Menu("Penalty");  
/*Menu*/ m491= new  Menu("Offense");  
   /*MenuItem*/ m4911 = new  MenuItem("5yard_");  
    m4911.addActionListener (new m4911lis());   
   m491.add (m4911);  
   /*MenuItem*/ m4912 = new  MenuItem("10yard_");  
    m4912.addActionListener (new m4912lis());   
   m491.add (m4912);  
   /*MenuItem*/ m4913 = new  MenuItem("15yard_");  
    m4913.addActionListener (new m4913lis());   
   m491.add (m4913);  
   /*MenuItem*/ m4914 = new  MenuItem("HalfDistance_");  
    m4914.addActionListener (new m4914lis());   
   m491.add (m4914);  
   /*MenuItem*/ m4915 = new  MenuItem("Other_");  
    m4915.addActionListener (new m4915lis());   
   m491.add (m4915);  
  m49.add (m491);  
/*Menu*/ m492= new  Menu("Defense");  
   /*MenuItem*/ m4921 = new  MenuItem("5 yard");  
    m4921.addActionListener (new m4921lis());   
   m492.add (m4921);  
   /*MenuItem*/ m4922 = new  MenuItem("10 yard");  
    m4922.addActionListener (new m4922lis());   
   m492.add (m4922);  
   /*MenuItem*/ m4923 = new  MenuItem("15 yard");  
    m4923.addActionListener (new m4923lis());   
   m492.add (m4923);  
   /*MenuItem*/ m4924 = new  MenuItem("Half Distance");  
    m4924.addActionListener (new m4924lis());   
   m492.add (m4924);  
   /*MenuItem*/ m4925 = new  MenuItem("Other");  
    m4925.addActionListener (new m4925lis());   
   m492.add (m4925);  
  m49.add (m492);  
/*Menu*/ m493= new  Menu("Penalty on kickoff or punt");  
/*Menu*/ m4931= new  Menu("On_Home_Team");  
    /*MenuItem*/ m49311 = new  MenuItem("5_yards");  
     m49311.addActionListener (new m49311lis());   
    m4931.add (m49311);  
    /*MenuItem*/ m49312 = new  MenuItem("10_yards");  
     m49312.addActionListener (new m49312lis());   
    m4931.add (m49312);  
    /*MenuItem*/ m49313 = new  MenuItem("15_yards");  
     m49313.addActionListener (new m49313lis());   
    m4931.add (m49313);  
    /*MenuItem*/ m49314 = new  MenuItem("_Other");  
     m49314.addActionListener (new m49314lis());   
    m4931.add (m49314);  
   m493.add (m4931);  
/*Menu*/ m4932= new  Menu("On_Visiting_Team");  
    /*MenuItem*/ m49321 = new  MenuItem("5_yards_");  
     m49321.addActionListener (new m49321lis());   
    m4932.add (m49321);  
    /*MenuItem*/ m49322 = new  MenuItem("10_yards_");  
     m49322.addActionListener (new m49322lis());   
    m4932.add (m49322);  
    /*MenuItem*/ m49323 = new  MenuItem("15_yards_");  
     m49323.addActionListener (new m49323lis());   
    m4932.add (m49323);  
    /*MenuItem*/ m49324 = new  MenuItem("_Other_");  
     m49324.addActionListener (new m49324lis());   
    m4932.add (m49324);  
   m493.add (m4932);  
  m49.add (m493);  
  /*MenuItem*/ m494 = new  MenuItem("AutomaticFirstDown");  
   m494.addActionListener (new m494lis());   
  m49.add (m494);  
 m4.add (m49);  
 /*MenuItem*/ m410 = new  MenuItem("FieldGoal");  
  m410.addActionListener (new m410lis());   
 m4.add (m410);  
 /*MenuItem*/ m411 = new  MenuItem("missedFieldGoal");  
  m411.addActionListener (new m411lis());   
 m4.add (m411);  
 /*MenuItem*/ m412 = new  MenuItem("EndofQuarter");  
  m412.addActionListener (new m412lis());   
 m4.add (m412);  
m0.add (m4);  
   
/*Menu*/ m5= new  Menu("Kickoff");  
 /*MenuItem*/ m51 = new  MenuItem("VisitingTeamReceives");  
  m51.addActionListener (new m51lis());   
 m5.add (m51);  
 /*MenuItem*/ m52 = new  MenuItem("HomeTeamReceives");  
  m52.addActionListener (new m52lis());   
 m5.add (m52);  
m0.add (m5);  
   
setMenuBar(m0);  
addMouseListener(this) ;  
} /*end init*/ 
  
public  void  mouseMoved(MouseEvent e) {} 
public  void  mouseDragged(MouseEvent e) {} 
public  void  mouseReleased(MouseEvent e) {} 
public  void  mouseClicked(MouseEvent e) {} 
public  void  mouseEntered(MouseEvent e) {} 
public  void  mouseExited(MouseEvent e) {} 
  
/*method*/ public void mousePressed(MouseEvent  e) {  
/*mx and my are the mouse coordinates*/  
int  mx=e.getX() ;  
int  my=e.getY() ;  
try { 
if ((!needkickoff)||(!(cs.equals(gamescreen)))) { 
screenparam csp=cs.getscreenparam(); /*csp=current screen parameters*/ 
int colnum2=1+(mx-csp.lm)/csp.w; 
int rownum2=(my-csp.tm)/csp.h; 
boolean found=false; 
int i=0; 
 
screenelement se=cs.elem[1]; 
 
while ((!found) & (i<=cs.numelements)) { 
i++; 
se=cs.elem[i]; 
 
if ((colnum2>=se.colstart) & (colnum2<=se.colend) & 
    (rownum2>=se.rowstart) & (rownum2<=se.rowend)) 
       {found=true;} 
 
screenelement se3=cs.elem[6]; 
 
} /*end while loop*/ 
 
 
int x2=mx-se.colstart*csp.w-csp.lm; 
int y2=my-se.rowstart*csp.h-csp.tm; 
 
if (found) {se.mouseprocess(x2,y2); 
 
int newstate=0; 
if ((se.equals(rushtable))&(state==1)) { 
newstate=2;  /*rushing player entered; waiting for yards*/ 
/*System.out.println("rushtable.selecteditem:"+rushtable.selecteditem);*/ 
if (rushtable.selecteditem<2) {rushtable.selecteditem=2;} 
 
} 
else if ((se.equals(passtable))&(state==1)) { 
newstate=3; /*passing player entered; waiting for receiver or 0 yards*/ 
passplayer=currplay.t.passlist[passtable.selecteditem-1];          /* was 1 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<0) {state=newstate;} 
 
 
} /*end if found*/ 
} /*end if !needkickoff*/ 
} catch (Exception ex) { } 
repaint();   
 } /*end mousePressed*/  
  
 
/*here are the declarations for the buttons:*/  
 
 /*declare the menus and menuitems:*/  
Menu m1;  
 MenuItem m11;  
  MenuItem m12;  
  MenuItem m13;  
  MenuItem m14;  
  MenuItem m15;  
 Menu m2;  
Menu m21;  
  MenuItem m211;  
   MenuItem m212;  
 Menu m22;  
  MenuItem m221;  
   MenuItem m222;  
  MenuItem m23;  
 Menu m24;  
Menu m241;  
   MenuItem m2411;  
    MenuItem m2412;  
    MenuItem m2413;  
    MenuItem m2414;  
 Menu m242;  
   MenuItem m2421;  
    MenuItem m2422;  
    MenuItem m2423;  
    MenuItem m2424;  
 Menu m243;  
   MenuItem m2431;  
    MenuItem m2432;  
    MenuItem m2433;  
    MenuItem m2434;  
 Menu m3;  
 MenuItem m31;  
  MenuItem m32;  
  MenuItem m33;  
  MenuItem m34;  
  MenuItem m35;  
  MenuItem m36;  
  MenuItem m37;  
  MenuItem m38;  
  MenuItem m39;  
  MenuItem m310;  
 Menu m311;  
  MenuItem m3111;  
   MenuItem m3112;  
   MenuItem m3113;  
   MenuItem m3114;  
   MenuItem m3115;  
   MenuItem m3116;  
   MenuItem m3117;  
   MenuItem m3118;  
 Menu m4;  
 MenuItem m41;  
  MenuItem m42;  
  MenuItem m43;  
  MenuItem m44;  
  MenuItem m45;  
  MenuItem m46;  
  MenuItem m47;  
  MenuItem m48;  
 Menu m49;  
Menu m491;  
   MenuItem m4911;  
    MenuItem m4912;  
    MenuItem m4913;  
    MenuItem m4914;  
    MenuItem m4915;  
 Menu m492;  
   MenuItem m4921;  
    MenuItem m4922;  
    MenuItem m4923;  
    MenuItem m4924;  
    MenuItem m4925;  
 Menu m493;  
Menu m4931;  
    MenuItem m49311;  
     MenuItem m49312;  
     MenuItem m49313;  
     MenuItem m49314;  
 Menu m4932;  
    MenuItem m49321;  
     MenuItem m49322;  
     MenuItem m49323;  
     MenuItem m49324;  
   MenuItem m494;  
  MenuItem m410;  
  MenuItem m411;  
  MenuItem m412;  
 Menu m5;  
 MenuItem m51;  
  MenuItem m52;  
  
  
/*method*/ public  void  paint (Graphics  g) { 
 
g.setFont(cs.currentfont); 
 
 
  /*the following block of code makes sure that the 
  correct menu items are enabled and disabled*/ 
 
if (!(fscore.cs.equals(fscore.gamescreen))) { 
   fscoreframe.m4.setEnabled(false); 
   fscoreframe.m5.setEnabled(false); 
                     } 
else { 
if (gamestarted) { 
 
if (needkickoff) { 
   fscoreframe.m4.setEnabled(false); 
   fscoreframe.m5.setEnabled(true); 
                 } 
else {fscoreframe.m4.setEnabled(true); 
      fscoreframe.m5.setEnabled(false); 
      } /*end else*/ 
     } /*end if gamestarted*/ 
 
else { if (hometeamset&&visitingteamset) {gamestarted=true; 
     fscoreframe.m2.setEnabled(true); 
     fscoreframe.m3.setEnabled(true); 
     fscoreframe.m4.setEnabled(false); 
     fscoreframe.m5.setEnabled(true); 
                 } 
  else { 
fscoreframe.m2.setEnabled(false); 
fscoreframe.m3.setEnabled(false); 
fscoreframe.m4.setEnabled(false); 
fscoreframe.m5.setEnabled(false); 
       } 
     } 
   } 
  /*end of menu enabling/disabling block*/ 
 
if (fscore.cs.equals(fscore.statscreen)) { 
team1names.synchstartitem(team1stats); 
team2names.synchstartitem(team2stats); 
} /*if cs equals statscreen*/ 
 
if (currplay!=null) {updategame();} else 
{scoreboard1.setnumitems(1); 
/*System.out.println("in paint: t1.score="+t1.score+"  t2.score="+t2.score);*/ 
scoreboard1.additem(t1.teamname+" "+t1.score+"  "+t2.teamname+" "+t2.score,1); 
rushtable.setnumitems(0); 
passtable.setnumitems(0); 
rectable.setnumitems(0); 
                                   } /* else else*/ 
cs.drawscreen(g); 
} /*end paint */ 
  
   
/*inner*/ class m11lis implements ActionListener {  
/*action called by menu item LoadVisitingTeam*/  
public void actionPerformed(ActionEvent e) {  
setvisitingteam();  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m11lis */  
   
/*inner*/ class m12lis implements ActionListener {  
/*action called by menu item LoadHomeTeam*/  
public void actionPerformed(ActionEvent e) {  
sethometeam();  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m12lis */  
   
/*inner*/ class m13lis implements ActionListener {  
/*action called by menu item CreateTeamFile*/  
public void actionPerformed(ActionEvent e) {  
readteam rd=new readteam(fscoreframe,"Enter players");  
rd.setVisible(true);  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m13lis */  
   
/*inner*/ class m14lis implements ActionListener {  
/*action called by menu item SaveGameTextFile*/  
public void actionPerformed(ActionEvent e) {  
FileDialog fd = new FileDialog(fscoreframe,"Save",FileDialog.SAVE);  
fd.setVisible(true);  
String fn = fd.getFile();  
writetotextfile(fn);  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m14lis */  
   
/*inner*/ class m15lis implements ActionListener {  
/*action called by menu item Exit*/  
public void actionPerformed(ActionEvent e) {  
confirmbox c1=new confirmbox(fscoreframe,"Click OK to confirm exit");  
c1.notetext.setText(" ");  
c1.notetext.setEditable(false);  
c1.setVisible(true);  
if (c1.oktocontinue) {System.exit(0);}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m15lis */  
   
/*inner*/ class m211lis implements ActionListener {  
/*action called by menu item StandardColors_*/  
public void actionPerformed(ActionEvent e) {  
standardcolorselector csel=  
new standardcolorselector(fscoreframe,"Select color for home team");  
csel.setVisible(true);  
if (csel.oktocontinue) {t2.linecolor=csel.selectedcolor;}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m211lis */  
   
/*inner*/ class m212lis implements ActionListener {  
/*action called by menu item CustomColors_*/  
public void actionPerformed(ActionEvent e) {  
colorselector csel=  
new colorselector(fscoreframe,"Click on color for home team");  
csel.setVisible(true);  
t2.linecolor=csel.selectedcolor;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m212lis */  
   
/*inner*/ class m221lis implements ActionListener {  
/*action called by menu item StandardColors*/  
public void actionPerformed(ActionEvent e) {  
standardcolorselector csel=  
new standardcolorselector(fscoreframe,"Select color for visiting team");  
csel.setVisible(true);  
if (csel.oktocontinue) {t1.linecolor=csel.selectedcolor;}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m221lis */  
   
/*inner*/ class m222lis implements ActionListener {  
/*action called by menu item CustomColors*/  
public void actionPerformed(ActionEvent e) {  
colorselector csel=  
new colorselector(fscoreframe,"Click on color for visiting team");  
csel.setVisible(true);  
t1.linecolor=csel.selectedcolor;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m222lis */  
   
/*inner*/ class m23lis implements ActionListener {  
/*action called by menu item StopRecordingTimeOfPossession*/  
public void actionPerformed(ActionEvent e) {  
confirmbox c1=new confirmbox(fscoreframe,  
      "Click OK to stop recording time of possession");  
c1.setVisible(true);  
if (c1.oktocontinue) {recordtimestats=false;  
fscoreframe.m23.setEnabled(false);}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m23lis */  
   
/*inner*/ class m2411lis implements ActionListener {  
/*action called by menu item 1st down*/  
public void actionPerformed(ActionEvent e) {  
currplay.down=1;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m2411lis */  
   
/*inner*/ class m2412lis implements ActionListener {  
/*action called by menu item 2nd down*/  
public void actionPerformed(ActionEvent e) {  
currplay.down=2;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m2412lis */  
   
/*inner*/ class m2413lis implements ActionListener {  
/*action called by menu item 3rd down*/  
public void actionPerformed(ActionEvent e) {  
currplay.down=3;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m2413lis */  
   
/*inner*/ class m2414lis implements ActionListener {  
/*action called by menu item 4th down*/  
public void actionPerformed(ActionEvent e) {  
currplay.down=4;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m2414lis */  
   
/*inner*/ class m2421lis implements ActionListener {  
/*action called by menu item Add one yard*/  
public void actionPerformed(ActionEvent e) {  
if (currplay.ytg1) {currplay.ytg--;}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m2422lis */  
   
/*inner*/ class m2423lis implements ActionListener {  
/*action called by menu item Add five yards*/  
public void actionPerformed(ActionEvent e) {  
if (currplay.ytg5) {currplay.ytg-=5;}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m2424lis */  
   
/*inner*/ class m2431lis implements ActionListener {  
/*action called by menu item Forward one yard*/  
public void actionPerformed(ActionEvent e) {  
if (currplay.tddist>1) {  
currplay.ydline+=currplay.t.dir;  
if (currplay.down==1) {currplay.ytg=10;}  
              else {if (currplay.ytg>=1) {currplay.ytg-=1;}}  
currplay.ydline1=new yardlineclass(currplay.ydline);  
    }  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m2431lis */  
   
/*inner*/ class m2432lis implements ActionListener {  
/*action called by menu item Backward one yard*/  
public void actionPerformed(ActionEvent e) {  
if (currplay.tddist<99) {  
currplay.ydline-=currplay.t.dir;  
if (currplay.down==1) {currplay.ytg=10;}  
              else {currplay.ytg++;}  
currplay.ydline1=new yardlineclass(currplay.ydline);  
     }  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m2432lis */  
   
/*inner*/ class m2433lis implements ActionListener {  
/*action called by menu item Forward five yards*/  
public void actionPerformed(ActionEvent e) {  
if (currplay.tddist>5) {  
currplay.ydline+=currplay.t.dir*5;  
if (currplay.down==1) {currplay.ytg=10;}  
              else {if (currplay.ytg>=6) {currplay.ytg-=5;}}  
currplay.ydline1=new yardlineclass(currplay.ydline);  
    }  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m2433lis */  
   
/*inner*/ class m2434lis implements ActionListener {  
/*action called by menu item Backward five yards*/  
public void actionPerformed(ActionEvent e) {  
if (currplay.tddist<95) {  
currplay.ydline-=currplay.t.dir*5;  
if (currplay.down==1) {currplay.ytg=10;}  
              else {if (currplay.ytg>=6) {currplay.ytg+=5;}}  
currplay.ydline1=new yardlineclass(currplay.ydline);  
                       }  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m2434lis */  
   
/*inner*/ class m31lis implements ActionListener {  
/*action called by menu item GameAction*/  
public void actionPerformed(ActionEvent e) {  
cs=gamescreen;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m31lis */  
   
/*inner*/ class m32lis implements ActionListener {  
/*action called by menu item Scoring*/  
public void actionPerformed(ActionEvent e) {  
updatescore();  
cs=scorescreen;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m32lis */  
   
/*inner*/ class m33lis implements ActionListener {  
/*action called by menu item GameStatistics*/  
public void actionPerformed(ActionEvent e) {  
updatestats(t1,team1names,team1stats,1);  
updatestats(t2,team2names,team2stats,1);  
statscreen.setfont(font2);  
cs=statscreen;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m33lis */  
   
/*inner*/ class m34lis implements ActionListener {  
/*action called by menu item SeasonStatistics*/  
public void actionPerformed(ActionEvent e) {  
updatestats(t1,team1names,team1stats,2);  
updatestats(t2,team2names,team2stats,2);  
statscreen.setfont(font2);  
cs=statscreen;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m34lis */  
   
/*inner*/ class m35lis implements ActionListener {  
/*action called by menu item TeamStatistics*/  
public void actionPerformed(ActionEvent e) {  
updateteamstats(t1,t2,teamstats);  
cs=teamstatscreen;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m35lis */  
   
/*inner*/ class m36lis implements ActionListener {  
/*action called by menu item Rosters*/  
public void actionPerformed(ActionEvent e) {  
updaterosters(t1,team1roster);  
updaterosters(t2,team2roster);  
cs=rosterscreen;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m36lis */  
   
/*inner*/ class m37lis implements ActionListener {  
/*action called by menu item PlaybyPlay*/  
public void actionPerformed(ActionEvent e) {  
playbyplaylist.resetstart();  
cs=playbyplayscreen;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m37lis */  
   
/*inner*/ class m38lis implements ActionListener {  
/*action called by menu item DriveSummary*/  
public void actionPerformed(ActionEvent e) {  
updatedrivesumm();  
cs=drivesummscreen;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m38lis */  
   
/*inner*/ class m39lis implements ActionListener {  
/*action called by menu item FullScreenDiagram*/  
public void actionPerformed(ActionEvent e) {  
cs=fullscreenview;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m39lis */  
   
/*inner*/ class m310lis implements ActionListener {  
/*action called by menu item ReverseDirection*/  
public void actionPerformed(ActionEvent e) {  
reversedirection=!reversedirection;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m310lis */  
   
/*inner*/ class m3111lis implements ActionListener {  
/*action called by menu item SlideUp*/  
public void actionPerformed(ActionEvent e) {  
ftbfield.startdrive++;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m3111lis */  
   
/*inner*/ class m3112lis implements ActionListener {  
/*action called by menu item SlideUp5*/  
public void actionPerformed(ActionEvent e) {  
ftbfield.startdrive+=5;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m3112lis */  
   
/*inner*/ class m3113lis implements ActionListener {  
/*action called by menu item SlideDown*/  
public void actionPerformed(ActionEvent e) {  
ftbfield.startdrive--;  
if (ftbfield.startdrive<=0) {ftbfield.startdrive=1;}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m3113lis */  
   
/*inner*/ class m3114lis implements ActionListener {  
/*action called by menu item SlideDown5*/  
public void actionPerformed(ActionEvent e) {  
ftbfield.startdrive-=5;  
if (ftbfield.startdrive<=0) {ftbfield.startdrive=1;}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m3114lis */  
   
/*inner*/ class m3115lis implements ActionListener {  
/*action called by menu item IncreaseSeparation*/  
public void actionPerformed(ActionEvent e) {  
ftbfield.rowspacing++;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m3115lis */  
   
/*inner*/ class m3116lis implements ActionListener {  
/*action called by menu item IncreaseSeparation5*/  
public void actionPerformed(ActionEvent e) {  
ftbfield.rowspacing+=5;  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m3116lis */  
   
/*inner*/ class m3117lis implements ActionListener {  
/*action called by menu item DecreaseSeparation*/  
public void actionPerformed(ActionEvent e) {  
ftbfield.rowspacing--;  
if (ftbfield.rowspacing<=2) {ftbfield.rowspacing=2;}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m3117lis */  
   
/*inner*/ class m3118lis implements ActionListener {  
/*action called by menu item DecreaseSeparation5*/  
public void actionPerformed(ActionEvent e) {  
ftbfield.rowspacing-=5;  
if (ftbfield.rowspacing<=2) {ftbfield.rowspacing=2;}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m3118lis */  
   
/*inner*/ class m41lis implements ActionListener {  
/*action called by menu item Rushing*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {  
ftbinbox in1;  
in1=new ftbinbox(fscoreframe,  
"Enter runner number, space, final yard line", currplay.t, true);  
in1.setVisible(true);  
if (in1.oktocontinue) {  
int newydline=in1.ydline;  
int runlength=currplay.t.dir*(newydline-currplay.ydline);  
currplay=currplay.advanceball(runlength,in1.playerid,0,0,fscoreframe);  
   }  
   } /*end !needkickoff*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m41lis */  
   
/*inner*/ class m42lis implements ActionListener {  
/*action called by menu item Passing*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {  
ftbinbox in1;  
in1=new ftbinbox(fscoreframe,  
"Enter passer number-receiver number, final yard line",currplay.t, false);  
in1.setVisible(true);  
if (in1.oktocontinue) {  
try {  
String passstring=in1.msgtext.getText();  
passstring=passstring.trim();  
/*System.out.println("|"+passstring+"|");*/  
int L=passstring.indexOf("-");  
String qbstring=passstring.substring(0,L).trim();  
/*System.out.println("qbstring: |"+qbstring+"|");*/  
passstring=passstring.substring(L+1);  
int L2=passstring.indexOf(" ");  
String recstring=passstring.substring(0,L2).trim();  
/*System.out.println("recstring: |"+recstring+"|");*/  
passstring=passstring.substring(L2+1);  
passstring=passstring.trim();  
int qbnum=Integer.parseInt(qbstring); /*jersey number*/  
int recnum=Integer.parseInt(recstring);  /*jersey number*/  
/*System.out.println("numbers: "+qbnum+" "+recnum);*/  
  
int qbnum2=currplay.t.findplayernum(qbnum,fscoreframe);  /*array id number*/  
int recnum2=currplay.t.findplayernum(recnum,fscoreframe);  /*array id number*/  
int newydline=in1.processyardstring(passstring);  
int passlength=currplay.t.dir*(newydline-currplay.ydline);  
currplay=currplay.advanceball(passlength,0,qbnum2,recnum2,fscoreframe);  
      } catch (Exception ex) { }  
      } /*end if oktocontinue*/  
    } /*end !needkickoff*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m42lis */  
   
/*inner*/ class m43lis implements ActionListener {  
/*action called by menu item NewPasser*/  
public void actionPerformed(ActionEvent e) {  
ftbinbox in1=new ftbinbox(fscoreframe,"Enter number of new passer for "+  
    currplay.t.teamname,currplay.t,false);  
 in1.setVisible(true);  
 if (in1.oktocontinue) {  
    try {  
      currplay.t.passlist[1]=  
    currplay.t.findplayernum(Integer.parseInt(in1.msgtext.getText().trim()),  
          fscoreframe);  
         } catch (Exception ex) { }  
    } /*end if oktocontinue*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m43lis */  
   
/*inner*/ class m44lis implements ActionListener {  
/*action called by menu item Punt*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {  
ftbinbox in1;  
in1 =new ftbinbox(fscoreframe,  
"Enter punter number, space, then yard line where punt lands",  
   currplay.t,true);  
String punterstring=  
   String.valueOf(currplay.t.player[currplay.t.punter].number);  
in1.msgtext.setText(punterstring);  
statclass puntstat=currplay.t.player[currplay.t.punter].stat;  
String punterstatstring=  
    currplay.t.player[currplay.t.punter].name+" "+puntstat.punts+  
   " punts, avg: "+puntstat.avgcalc(puntstat.puntyds,puntstat.punts,1);  
in1.msgtext2.setText(punterstatstring);  
in1.setVisible(true);  
if (in1.oktocontinue) {  
 try {  
int newydline=in1.ydline;  
int puntlength=currplay.t.dir*(newydline-currplay.ydline);  
if (newydline>=100) {newydline=80;}  
if (newydline<=0) {newydline=20;}  
  yardlineclass puntyardline=new yardlineclass(newydline);  
 confirmbox c1=new confirmbox(fscoreframe,currplay.t.player[in1.playerid].name+" "+  
    puntlength+" yard punt to "+puntyardline.ydline2());  
  c1.setVisible(true);  
   if (c1.oktocontinue) {  
puntclass punt1=new puntclass(currplay.t, currplay.dt, in1.playerid,  
     puntlength,c1.notestring);  
currdrive.driveend(punt1);  
 currplay.t.punter=in1.playerid;  
  
  /*new get punt return information*/  
boolean stillneedreturninfo=true;  
while (stillneedreturninfo) {  
in1=new ftbinbox(fscoreframe,  
"Enter return player number, space, then yard line at end of return",  
currplay.dt,true);  
in1.setVisible(true);  
String puntreturndescription="";  
int newydline3=0;  
int returnlength=0;  
if (!(in1.playerid==0)) {  
int newydline2=in1.ydline;  
returnlength=currplay.dt.dir*(newydline2-newydline);  
newydline3=returnyardlinecalc(currplay.dt,newydline2);  
yardlineclass finalyardline=new yardlineclass(newydline3);  
puntreturndescription=  
   currplay.dt.player[in1.playerid].name+" "+returnlength+" return";  
if ((newydline2>=100)||(newydline2<=0))  
    {puntreturndescription+=" TOUCHDOWN";}  
else {puntreturndescription+=" to "+finalyardline.ydline2();}  
                        }  
else {puntreturndescription=" no return; start at "+puntyardline.ydline2();}  
confirmbox c2=new confirmbox(fscoreframe,puntreturndescription);  
c2.setVisible(true);  
if (c2.oktocontinue) {  
   stillneedreturninfo=false;  
if ((in1.playerid==0)||(!in1.oktocontinue)) { /*no return*/  
   currdrive=new driveclass(currplay.dt,currplay.t,newydline,null);  
   currplay=currdrive.play[1];  
         }  /*end no punt return*/  
else { /*punt return*/  
puntreturnclass pr1=new puntreturnclass(in1.playerid,  
returnlength, false, quarter, currplay.dt, currplay.t, c2.notestring);  
currdrive=new driveclass(currplay.dt,currplay.t,newydline3,pr1);  
currplay=currdrive.play[1];  
if ((newydline3>=100)|(newydline3<=0))  
  { returntd(currplay.t,currplay.dt,in1.playerid,returnlength,"punt");}  
  } /*end there was a return*/  
       } /*end if c2.oktocontinue*/  
      } /*end while*/  
     } /*end if c1.oktocontinue*/  
    } catch (Exception ex) { }  
   } /*end if in1.oktocontinue*/  
  } /*end !needkickoff*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m44lis */  
   
/*inner*/ class m45lis implements ActionListener {  
/*action called by menu item Interception*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {  
ftbinbox in1;  
in1=new ftbinbox(fscoreframe,  
"Enter intercepting player, yard line at start, yard line at end",  
currplay.dt,true);  
in1.setVisible(true);  
if (in1.oktocontinue) {  
int returnlength=currplay.dt.dir*(in1.ydline2-in1.ydline);  
String finalyardstring="";  
if ((in1.ydline2<=0)||(in1.ydline2>=100)) {finalyardstring="TOUCHDOWN";}  
else {yardlineclass finalydline=new yardlineclass(in1.ydline2);  
  finalyardstring=" to "+finalydline.ydline2();}  
confirmbox c1=new confirmbox(fscoreframe,  
currplay.t.player[currplay.t.passlist[1]].name+" intercepted by "+  
currplay.dt.player[in1.playerid].name+",  "+returnlength+  
     " return to "+finalyardstring);  
c1.setVisible(true);  
if (c1.oktocontinue) {  
interception int1=new interception(currplay.t,currplay.dt,  
currplay.t.passlist[1], in1.playerid,currplay.down,c1.notestring);  
  
currdrive.driveend(int1);  
intreturnclass intret1;  
if (in1.playerid==0) {intret1=null;}  
else {intret1=new intreturnclass(in1.playerid,  
returnlength,false,quarter,currplay.dt,currplay.t," ");}  
  
int newydline3=returnyardlinecalc(currplay.dt,in1.ydline2);  
currdrive=new driveclass(currplay.dt,currplay.t,newydline3,intret1);  
currplay=currdrive.play[1];  
if ((newydline3>=100)|(newydline3<=0))  
  { returntd(currplay.t,currplay.dt,in1.playerid,returnlength,"interception");}  
        } /*end if c1.oktocontinue*/  
     }  /*end if in1.oktocontinue*/  
  } /* end !needkickoff*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m45lis */  
   
/*inner*/ class m46lis implements ActionListener {  
/*action called by menu item Lost Fumble*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {  
ftbinbox in1;  
in1=new ftbinbox(fscoreframe,  
"Enter recovering player number, yard line at start, then yard line at end",  
       currplay.dt,true);  
in1.setVisible(true);  
if (in1.oktocontinue) {  
int returnlength=currplay.dt.dir*(in1.ydline2-in1.ydline);  
int newydline=in1.ydline2;  
String finalyardlinestring="";  
if ((newydline<=0)||(newydline>=100)) {finalyardlinestring="TOUCHDOWN";}  
else {yardlineclass finalyardline=new yardlineclass(newydline);  
finalyardlinestring=" to "+finalyardline.ydline2();}  
  
confirmbox c1=new confirmbox(fscoreframe,  
("Fumble: return "+returnlength+" yards, "+finalyardlinestring));  
c1.setVisible(true);  
if (c1.oktocontinue) {  
fumble fumb1=new fumble(currplay.t, currplay.dt, currplay.down,c1.notestring);  
int newydline3=returnyardlinecalc(currplay.dt,newydline);  
currdrive.driveend(fumb1);  
currdrive=new driveclass(currplay.dt,currplay.t,newydline3,null);  
currplay=currdrive.play[1];  
if ((newydline3>=100)|(newydline3<=0))  
  { returntd(currplay.t,currplay.dt,in1.playerid,returnlength," fumble");}  
       } /*end if c1.oktocontinue*/  
     }  /*end if in1.oktocontinue*/  
  } /*end !needkickoff*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m46lis */  
   
/*inner*/ class m47lis implements ActionListener {  
/*action called by menu item Fumble (not lost)*/  
public void actionPerformed(ActionEvent e) {  
String fumbledescription="("+currplay.t.teamname+" recovered fumble)";  
confirmbox c1=new confirmbox(fscoreframe,fumbledescription);  
c1.setVisible(true);  
if (c1.oktocontinue) {  
    playbyplaylist.additem(fumbledescription+" "+c1.notestring);  
    currplay.t.fumblesnotlost++;  
                      }  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m47lis */  
   
/*inner*/ class m48lis implements ActionListener {  
/*action called by menu item Sack*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {  
ftbinbox in1;  
in1=new ftbinbox(fscoreframe,  
"Enter yards lost by sack",  
currplay.dt,false);  
in1.setVisible(true);  
if (in1.oktocontinue) {  
try {  
  int ydslost=Math.abs(Integer.parseInt(in1.msgtext.getText().trim()));  
  currplay=currplay.advanceball(-ydslost,-2,0,0,fscoreframe);  
    } catch(Exception ex) { } /*ignore if input data invalid*/  
    } /*end oktocontinue*/  
   } /*end !needkickoff*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m48lis */  
   
/*inner*/ class m4911lis implements ActionListener {  
/*action called by menu item 5yard_*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {offpenalty(5);}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m4911lis */  
   
/*inner*/ class m4912lis implements ActionListener {  
/*action called by menu item 10yard_*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {offpenalty(10);}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m4912lis */  
   
/*inner*/ class m4913lis implements ActionListener {  
/*action called by menu item 15yard_*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {offpenalty(15);}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m4913lis */  
   
/*inner*/ class m4914lis implements ActionListener {  
/*action called by menu item HalfDistance_*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {int pendistance=0;  
if ((currplay.t.dir==1)&(currplay.ydline<=30))  
   {pendistance=currplay.ydline/2;}  
if ((currplay.t.dir==-1)&(currplay.ydline>=70))  
    {pendistance=(100-currplay.ydline)/2;}  
if (pendistance>0) {offpenalty(pendistance);}  
  } /*end !needkickoff*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m4914lis */  
   
/*inner*/ class m4915lis implements ActionListener {  
/*action called by menu item Other_*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {  
ftbinbox in1;  
in1=new ftbinbox(fscoreframe,  
"Enter new yard line",currplay.t,true);  
in1.setVisible(true);  
if (in1.oktocontinue) {  
int newydline=in1.ydline;  
int pendistance=currplay.t.dir*(currplay.ydline-newydline);  
offpenalty(pendistance);}  
  } /*end !needkickoff*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m4915lis */  
   
/*inner*/ class m4921lis implements ActionListener {  
/*action called by menu item 5 yard*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {defpenalty(5);}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m4921lis */  
   
/*inner*/ class m4922lis implements ActionListener {  
/*action called by menu item 10 yard*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {defpenalty(10);}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m4922lis */  
   
/*inner*/ class m4923lis implements ActionListener {  
/*action called by menu item 15 yard*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {defpenalty(15);}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m4923lis */  
   
/*inner*/ class m4924lis implements ActionListener {  
/*action called by menu item Half Distance*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {  
int pendistance=0;  
if ((currplay.t.dir==-1)&(currplay.ydline<=30))  
       {pendistance=currplay.ydline/2;}  
if ((currplay.t.dir==1)&(currplay.ydline>=70))  
       {pendistance=(100-currplay.ydline)/2;}  
if (pendistance>0) {defpenalty(pendistance);}  
  } /*end !needkickoff*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m4924lis */  
   
/*inner*/ class m4925lis implements ActionListener {  
/*action called by menu item Other*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {  
ftbinbox in1;  
in1=new ftbinbox(fscoreframe,  
"Enter new yard line",currplay.t,true);  
in1.setVisible(true);  
if (in1.oktocontinue) {  
int newydline=in1.ydline;  
int pendistance=currplay.dt.dir*(currplay.ydline-newydline);  
defpenalty(pendistance);}  
   } /* end !needkickoff*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m4925lis */  
   
/*inner*/ class m49311lis implements ActionListener {  
/*action called by menu item 5_yards*/  
public void actionPerformed(ActionEvent e) {  
addpenalty(t2,5,true);  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m49311lis */  
   
/*inner*/ class m49312lis implements ActionListener {  
/*action called by menu item 10_yards*/  
public void actionPerformed(ActionEvent e) {  
addpenalty(t2,10,true);  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m49312lis */  
   
/*inner*/ class m49313lis implements ActionListener {  
/*action called by menu item 15_yards*/  
public void actionPerformed(ActionEvent e) {  
addpenalty(t2,15,true);  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m49313lis */  
   
/*inner*/ class m49314lis implements ActionListener {  
/*action called by menu item _Other*/  
public void actionPerformed(ActionEvent e) {  
ftbinbox in1;  
in1=new ftbinbox(fscoreframe,  
"Enter penalty yards",t2,false);  
in1.msgtext2.setText("penalty on "+t2.teamname);  
in1.setVisible(true);  
if (in1.oktocontinue) {  
try {int penyards=Integer.parseInt(in1.msgtext.getText().trim());  
addpenalty(t2,penyards,false);  
       } catch(Exception ex) { } /*ignore invalid input*/  
       } /*end if (in1.oktocontinue*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m49314lis */  
   
/*inner*/ class m49321lis implements ActionListener {  
/*action called by menu item 5_yards_*/  
public void actionPerformed(ActionEvent e) {  
addpenalty(t1,5,true);  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m49321lis */  
   
/*inner*/ class m49322lis implements ActionListener {  
/*action called by menu item 10_yards_*/  
public void actionPerformed(ActionEvent e) {  
addpenalty(t1,10,true);  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m49322lis */  
   
/*inner*/ class m49323lis implements ActionListener {  
/*action called by menu item 15_yards_*/  
public void actionPerformed(ActionEvent e) {  
addpenalty(t1,15,true);  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m49323lis */  
   
/*inner*/ class m49324lis implements ActionListener {  
/*action called by menu item _Other_*/  
public void actionPerformed(ActionEvent e) {  
ftbinbox in1;  
in1=new ftbinbox(fscoreframe,  
"Enter penalty yards",t1,false);  
in1.msgtext2.setText("penalty on "+t1.teamname);  
in1.setVisible(true);  
if (in1.oktocontinue) {  
try {int penyards=Integer.parseInt(in1.msgtext.getText().trim());  
addpenalty(t1,penyards,false);  
     } catch(Exception ex) { } /*ignore invalid input*/  
      } /*end if (in1.oktocontinue*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m49324lis */  
   
/*inner*/ class m494lis implements ActionListener {  
/*action called by menu item AutomaticFirstDown*/  
public void actionPerformed(ActionEvent e) {  
confirmbox c1=new confirmbox(fscoreframe,  
"Click OK if this penalty has an automatic first down");  
c1.setVisible(true);  
if (c1.oktocontinue) {currplay.down=1; currplay.ytg=10;  
currplay.chainendyardline=currplay.ydline+currplay.t.dir*currplay.ytg;  
currplay.chainstartyardline=currplay.chainendyardline-currplay.t.dir*10;  
playbyplaylist.concat("automatic 1-10:");  
                     }  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m494lis */  
   
/*inner*/ class m410lis implements ActionListener {  
/*action called by menu item FieldGoal*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {  
fieldgoal fg1=new fieldgoal(currplay.t, currplay.dt, currplay.tddist);  
ftbinbox in1;  
in1=new ftbinbox(fscoreframe,  
"Field Goal description",currplay.t,false);  
in1.msgtext.setText(fg1.description());  
in1.setVisible(true);  
if (in1.oktocontinue) {  
currdrive.driveend(fg1);  
fieldgoalscrim fg2=new fieldgoalscrim(in1.msgtext.getText());  
addscore(currplay.t,currplay.dt,3,fg2);}  
  } /*end !Kickneeded*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m410lis */  
   
/*inner*/ class m411lis implements ActionListener {  
/*action called by menu item missedFieldGoal*/  
public void actionPerformed(ActionEvent e) {  
if (!fscore.needkickoff) {  
int newydline=currplay.ydline-currplay.t.dir*7;  
ftbinbox in1=null;  
confirmbox c3=null;  
boolean mfgwasreturned=false;  
int returnlength=100-currplay.tddist;  
if (currplay.t.dir==-1) { if (newydline<20) {newydline=20;}}  
else { if (newydline>80) {newydline=80;}}  
yardlineclass yd=new yardlineclass(newydline);  
confirmbox c1=new confirmbox(fscoreframe,"missed field goal: start at "+  
        yd.ydline2()+" (click cancel to change yardline)");  
c1.setVisible(true);  
boolean reallyismissedfieldgoal=true;  
boolean returnedfortouchdown=false;  
if (!(c1.oktocontinue)) {  
confirmbox  
  c2=new confirmbox(fscoreframe,"Click OK if it really is a missed field goal");  
c2.setVisible(true);  
if (c2.oktocontinue) {  
     boolean yardlineentered=false;  
     while (!yardlineentered) {  
    in1=  
    new ftbinbox(fscoreframe,  
    "Enter returning player and yard line after missed field goal return",  
        currplay.dt,true);  
    in1.setVisible(true);  
         if (in1.oktocontinue) {  
            newydline=in1.ydline;  
/*System.out.println("newydline:"+newydline);*/  
     String finalyardlinestring="";  
    if ((newydline<=0)||(newydline>=100)) {finalyardlinestring="TOUCHDOWN";}  
   else {yardlineclass finalyardline=new yardlineclass(newydline);  
          finalyardlinestring=" to "+finalyardline.ydline2();}  
  
   c3=new confirmbox(fscoreframe,  
     ("missed field goal return "+finalyardlinestring));  
     c3.setVisible(true);  
if (c3.oktocontinue) {  
              yardlineentered=true;  
              mfgwasreturned=true;  
if ((newydline>=100)|(newydline<=0))  
  {returnedfortouchdown=true;}  
                     } /*end if c3.oktocontinue*/  
                      } /*if in1.oktocontinue*/  
                      } /*end while*/  
                     } /*end if c2.oktocontinue*/  
         else {reallyismissedfieldgoal=false;}  
                     } /*end if not oktocontinue*/  
if (reallyismissedfieldgoal) {  
/*System.out.println("newydline:"+newydline);*/  
missedfieldgoal mfg1=new missedfieldgoal(currplay.t, currplay.dt);  
currdrive.driveend(mfg1);  
  
if (!mfgwasreturned) {  
   currdrive=new driveclass(currplay.dt,currplay.t,newydline,null);  
                      }  
else {  /*mfg was returned*/  
mfgreturnclass mfgr1=new mfgreturnclass(in1.playerid,  
returnlength, false, quarter, currplay.dt, currplay.t, c3.notestring);  
currdrive=new driveclass(currplay.dt,currplay.t,newydline,mfgr1);  
     }  
currplay=currdrive.play[1];  
 if (returnedfortouchdown) {  
 returntd(currplay.t,currplay.dt,in1.playerid,returnlength," missed field goal");  
                            }  
                     } /*end reallyismissedfieldgoal*/  
     } /*end !needkickoff*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m411lis */  
   
/*inner*/ class m412lis implements ActionListener {  
/*action called by menu item EndofQuarter*/  
public void actionPerformed(ActionEvent e) {  
confirmbox c1=new confirmbox(fscoreframe,"End of quarter "+quarter);  
c1.setVisible(true);  
if (c1.oktocontinue) {  
currplay.quarter++;  quarter++;  
if ((currplay.quarter==3)|(currplay.quarter==5))  
         {  
eoh eoh1=new eoh(currplay.t,currplay.dt);  
currdrive.driveend(eoh1);  
setneedkickoff(true);  
         } /*end 3 or 5*/  
if (quarter<=4) {  
String quarterstring=" ";  
if (quarter==2) {quarterstring="SECOND QUARTER";}  
else if (quarter==3) {quarterstring="THIRD QUARTER";}  
else if (quarter==4) {quarterstring="FOURTH QUARTER";}  
scorelist.additem(quarterstring);  
playbyplaylist.additem(quarterstring);  
if ((currplay.quarter==2)|(currplay.quarter==4)) {  
playbyplaylist.additem(currplay.downinfo());  
    } /*end quarter=2 or 4*/  
  } /*end quarter<=4*/  
  } /*end c1.oktocontinue*/  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m412lis */  
   
/*inner*/ class m51lis implements ActionListener {  
/*action called by menu item VisitingTeamReceives*/  
public void actionPerformed(ActionEvent e) {  
if (fscore.needkickoff) {kickreturn(t1,t2);}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m51lis */  
   
/*inner*/ class m52lis implements ActionListener {  
/*action called by menu item HomeTeamReceives*/  
public void actionPerformed(ActionEvent e) {  
if (fscore.needkickoff) {kickreturn(t2,t1);}  
fscoreframe.repaint (); 
} /*end actionPerformed */  
} /*end inner class m52lis */  
  
 /*to close the window:*/  
static class winlis extends WindowAdapter {  
public void windowClosing(WindowEvent e) {  
confirmbox c1=new confirmbox(fscoreframe,"Click OK to confirm exit"); 
c1.notetext.setText(" "); 
c1.notetext.setEditable(false); 
c1.setVisible(true); 
if (c1.oktocontinue) {System.exit(0);} 
System.exit(0);  
} /*end windowClosing */  
} /*end winlis*/   
  
public  static  void  main (String  args[]) { 
fscoreframe = new  fscore("fscore"); 
fscoreframe.addWindowListener(new winlis()); 
fscoreframe.init(); 
fscoreframe.setBounds (10,10,360,360);  
fscoreframe.setVisible(true); 
 } /*end main */ 
} /*end class  fscore*/ 

*: 

  public class  cpj {
/*public class with numerous useful methods*/
/*This has been modified for tapj  9/30/2000*/

/*This class contains methods that will be useful for
  other programs in this book.
  cpj is short for Computer Programming in Java
   the Easy Way*/

/*method*/  public static String  nf(double  x,
    int  fw, int  dp) {
  /*nf stands for number format; fw stands for field width;
    dp stands for decimal places*/

double  k=Math.pow (10,dp);
double  z=((double)(Math.round (x*k)))/k;
String  z2=String.valueOf (z);
      /*System.out.println("in nf: z=|"+z+"|  z2=|"+z2+"|");*/
  int exploc=z2.indexOf("E");
  if (exploc>=0) { /*number was in exponential notation*/
       String z3=z2.substring(0,exploc)+"00000000000000000000";
       String expstring=z2.substring(exploc+1);
         /* System.out.println("z3= |"+z3+"|  exp=|"+expstring+"|");*/
       int expnum=Integer.parseInt(expstring);
       int dploc1=z3.indexOf(".");
       if (expnum>=0) {
           /*System.out.println("expnum="+expnum);*/
       z2=z3.substring(0,dploc1)+
        z3.substring((dploc1+1),(expnum+dploc1+1))+"."+
        z3.substring(expnum+dploc1+1);
            /*System.out.println("z2=|"+z2+"|");*/
                       }
                  } /*end exponential notation*/

int  len=z2.length() ;
int  dploc=z2.indexOf (".");
/*System.out.println("x="+x+"  dp="+dp+"  z="+z+" |"+z2+"|  len="+len+"  dploc="+dploc);*/
if  (dp>0) {
/*System.out.println("  len-dploc-1="+(len-dploc-1));*/
int currentdp=len-dploc-1;
if (currentdp=0) {
z+=x2.substring (0,L)+b;
x2=x2.substring (L+alen);
L=x2.indexOf (a);
} /*end while loop*/
z+=x2;
return  z;
} /*end replacestring*/

/*method*/ public static String  blanks(int  n) {
 /*this method returns a string of blanks of length n*/
String  blankstring="                                            ";
String  z="";
if  ((n>0)&(n