Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Member Functions | Public Attributes | Package Attributes | Static Private Attributes
VreemdeEend2 Class Reference
Inheritance diagram for VreemdeEend2:
Inheritance graph
[legend]
Collaboration diagram for VreemdeEend2:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void init ()
void paint (Graphics canvas)
void start ()
void stop ()
void run ()
void update (Graphics canvas)
String ReadApplet ()

Static Public Member Functions

static int[] Shuffle (int[] S)

Public Attributes

int sy = 22
int xsize = 680
int ysize = 7*sy
long totaltime = 0
Image ok
Image nok

Package Attributes

Thread thread = null
Graphics canvas
String replystring = ""
int dx
int dy
long start
int foutcounter = 1
double diff
String duration = ""
int counter
int goedeantwoord
long stop
String[][] Antwoorden
int v1
int v2
int v3
int v4
String[] Vragen
int records = 0
int goedzo = 1
int klaar = 0
int volgorde [] = {1,2,3,4}
long begin
int pressed = 1
int vraagnummers []
int fnsize = 14
Font defaultFont = new Font( "Helvetica", Font.BOLD, fnsize )
Color blauw = new Color(0,0,255)
Color zwart = new Color(0,0,0)
Color kleur
int max = 10
int m1 = 0
int m2 = 0

Static Private Attributes

static final long serialVersionUID = 1L

Detailed Description

Definition at line 15 of file VreemdeEend2.java.


Member Function Documentation

void VreemdeEend2.init ( ) [inline]

Definition at line 34 of file VreemdeEend2.java.

                      {
        begin=System.currentTimeMillis();klaar=0;
       ok=getImage(getCodeBase(), "ok.gif");nok=getImage(getCodeBase(), "nok.gif");
       String questions=getParameter("questions");if(questions==null){System.out.println("CAN NOT READ QUESTION PARAM");}
       String ss=getParameter("max");if(ss!=null && ss.length()>0){max = Integer.parseInt(ss, 10);}
       StringTokenizer vragen = new StringTokenizer(questions, ":");
       String vraag="";String antwoord="";int w=0;
       Antwoorden=new String[max][4*max];
       vraagnummers=new int[max+1];
       Vragen=new String[max+1];
       int tmp=0;
       for(int s=0;s<max-1;s++){
           vraag=vragen.nextToken();
           StringTokenizer antwoorden = new StringTokenizer(vraag, ";");
           w=antwoorden.countTokens();
           vraagnummers[s]=s;
           for(int r=0;r<w;r++){
              antwoord=antwoorden.nextToken();
              tmp=fnsize*antwoord.length();if(tmp>xsize){xsize=tmp;}
              if(r==0){
                  Vragen[s]=antwoord;
                  //System.out.println("de vraag = "+antwoord);
              }
              else
              {
                  Antwoorden[s][r-1]=antwoord;
                  //System.out.println("antwoord  ="+antwoord);
              }
           }
       }
       vraagnummers=Shuffle(vraagnummers);
       
       addMouseMotionListener(new MouseMotionAdapter(){
           public void mouseMoved(MouseEvent e){
              dy = e.getY();
              kleur=zwart;
              for(int i=2;i<6;i++){
                  m1=i*sy;m2=(i+1)*sy;
                  if(dy>m1 && dy<m2){
                     pressed=0;
                     kleur=blauw;
                     i=10;
                  }
              }
              repaint();
           }
       }
       );
       
       
       addMouseListener(
           new MouseAdapter(){
              public void mousePressed(MouseEvent e){
                  dx = e.getX();
                  dy = e.getY();
                  if(klaar==0){
                     kleur=zwart;
                     for(int p=2;p<7;p++){
                         if(dx>0 && dx<xsize){
                            if(dy>(p)*sy+5 && dy<(p+1)*sy+5){
                                if(counter==max){klaar=1;}
                                if(goedeantwoord==p){
                                   stop=System.currentTimeMillis();
                                   diff=(double)(stop-start)/1000;
                                   duration=duration+","+diff;
                                   replystring=replystring+"\n"+diff+":"+foutcounter;
                                   foutcounter=1;
                                   counter++;goedzo=1;
                                   start=System.currentTimeMillis();
                                   pressed=1;
                                }
                                else
                                {
                                   goedzo=0;foutcounter++;
                                   pressed=0;
                                }
                                repaint();
                            }
                         }
                     }
                  }
              }
           }
       );

    }

Here is the call graph for this function:

void VreemdeEend2.paint ( Graphics  canvas) [inline]

Definition at line 137 of file VreemdeEend2.java.

                                      {
       if(counter==0){start=begin;}
       if(klaar==0){
           int num=vraagnummers[counter];
           canvas.setColor(Color.black);canvas.fillRect(0,0,xsize,ysize);
           canvas.setColor(kleur);canvas.fillRect(0,m1+5,xsize,m2+5);
           canvas.setColor(Color.black);canvas.fillRect(0,m2+5,xsize,6*sy);
           canvas.setFont(defaultFont);canvas.setColor(Color.yellow);
           canvas.drawString("Multiplechoice Q "+(counter+1)+") ",10,sy);
           canvas.drawString(Vragen[num],10,2*sy);
           canvas.setColor(Color.white);
           if(pressed!=0){volgorde=Shuffle(volgorde);}
           int k;
           for(int p=0;p<4;p++){
              k=volgorde[p];
              if(k==4){goedeantwoord=p+2;}
              canvas.setColor(Color.red);canvas.drawLine(0,(p+3)*(sy)+5,xsize,(p+3)*(sy)+5);
              canvas.setColor(Color.white);canvas.drawString((p+1)+") "+Antwoorden[num][k-1],10,(p+3)*(sy));
           }
           canvas.clearRect(0,6*sy+5,xsize,ysize);
           canvas.setColor(Color.black);canvas.fillRect(0,6*sy+5,xsize,ysize);
           if(goedzo==0){
              canvas.drawImage(nok,50,ysize, this);
           }
           else
           {
              canvas.drawImage(ok,50,ysize, this);
           }
       }
       
       if(klaar==1){
           canvas.setColor(Color.black);canvas.fillRect(0,0,xsize,ysize);
           canvas.setFont(defaultFont);
           StringTokenizer q = new StringTokenizer(replystring, "\n");
           int m=q.countTokens(); 
           String sub="";int X=10;int Y=10; 
           canvas.setColor(Color.white);
           canvas.drawString("time :attempts",X,Y);
           for(int s=0;s<m;s++){
              Y=Y+14;sub=q.nextToken(); canvas.drawString(sub,X,Y);
              if(Y>(ysize-14)){ X=X+120; Y=10;canvas.drawString("time :attempts",X,Y);}
           }
       }
                     //System.out.println("goede antwoord="+goedeantwoord);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String VreemdeEend2.ReadApplet ( ) [inline]

Definition at line 209 of file VreemdeEend2.java.

                          {
    if(counter<max){
       return "error: not finished";
    }
    else
    {
       double totaltime=(double) (stop-begin)/1000;
       return totaltime+":"+(max-1)+"\n"+replystring;
    }
}

Here is the call graph for this function:

void VreemdeEend2.run ( ) [inline]

Definition at line 195 of file VreemdeEend2.java.

                     {
       while(thread != null){
       try{
           Thread.sleep(100);
       }
       catch (InterruptedException e){
       }
    }
}
static int [] VreemdeEend2.Shuffle ( int[]  S) [inline, static]

Definition at line 122 of file VreemdeEend2.java.

                                        {
           int ll= S.length;
           for (int i=0;i<ll;i++){
              int r = (int) (Math.random() * (i+1));
              int swap = S[r];
              S[r] = S[i];
              S[i] = swap;
           }
           for(int i=0;i<ll;i++){
            //System.out.println(S[i]);
           }
        return S;
    }

Here is the caller graph for this function:

void VreemdeEend2.start ( ) [inline]

Definition at line 183 of file VreemdeEend2.java.

                       {
       if(thread == null){
           thread = new Thread(this);
           thread.start();
       }
    }

Here is the caller graph for this function:

void VreemdeEend2.stop ( ) [inline]

Definition at line 191 of file VreemdeEend2.java.

                      {
       thread =null;
    }

Here is the caller graph for this function:

void VreemdeEend2.update ( Graphics  canvas) [inline]

Definition at line 205 of file VreemdeEend2.java.

                                     {
    paint( canvas ) ;
}

Here is the call graph for this function:


Member Data Documentation

String [][] VreemdeEend2.Antwoorden [package]

Definition at line 24 of file VreemdeEend2.java.

long VreemdeEend2.begin [package]

Definition at line 26 of file VreemdeEend2.java.

Color VreemdeEend2.blauw = new Color(0,0,255) [package]

Definition at line 29 of file VreemdeEend2.java.

Graphics VreemdeEend2.canvas [package]

Definition at line 17 of file VreemdeEend2.java.

int VreemdeEend2.counter [package]

Definition at line 21 of file VreemdeEend2.java.

Font VreemdeEend2.defaultFont = new Font( "Helvetica", Font.BOLD, fnsize ) [package]

Definition at line 28 of file VreemdeEend2.java.

double VreemdeEend2.diff [package]

Definition at line 20 of file VreemdeEend2.java.

String VreemdeEend2.duration = "" [package]

Definition at line 20 of file VreemdeEend2.java.

int VreemdeEend2.dx [package]

Definition at line 19 of file VreemdeEend2.java.

int VreemdeEend2.dy [package]

Definition at line 19 of file VreemdeEend2.java.

int VreemdeEend2.fnsize = 14 [package]

Definition at line 28 of file VreemdeEend2.java.

int VreemdeEend2.foutcounter = 1 [package]

Definition at line 19 of file VreemdeEend2.java.

Definition at line 21 of file VreemdeEend2.java.

int VreemdeEend2.goedzo = 1 [package]

Definition at line 25 of file VreemdeEend2.java.

int VreemdeEend2.klaar = 0 [package]

Definition at line 25 of file VreemdeEend2.java.

Color VreemdeEend2.kleur [package]

Definition at line 31 of file VreemdeEend2.java.

int VreemdeEend2.m1 = 0 [package]

Definition at line 32 of file VreemdeEend2.java.

int VreemdeEend2.m2 = 0 [package]

Definition at line 32 of file VreemdeEend2.java.

int VreemdeEend2.max = 10 [package]

Definition at line 31 of file VreemdeEend2.java.

Definition at line 23 of file VreemdeEend2.java.

Definition at line 23 of file VreemdeEend2.java.

int VreemdeEend2.pressed = 1 [package]

Definition at line 26 of file VreemdeEend2.java.

int VreemdeEend2.records = 0 [package]

Definition at line 25 of file VreemdeEend2.java.

String VreemdeEend2.replystring = "" [package]

Definition at line 17 of file VreemdeEend2.java.

final long VreemdeEend2.serialVersionUID = 1L [static, private]

Definition at line 16 of file VreemdeEend2.java.

long VreemdeEend2.start [package]

Definition at line 19 of file VreemdeEend2.java.

long VreemdeEend2.stop [package]

Definition at line 22 of file VreemdeEend2.java.

int VreemdeEend2.sy = 22

Definition at line 18 of file VreemdeEend2.java.

Thread VreemdeEend2.thread = null [package]

Definition at line 17 of file VreemdeEend2.java.

Definition at line 22 of file VreemdeEend2.java.

int VreemdeEend2.v1 [package]

Definition at line 24 of file VreemdeEend2.java.

int VreemdeEend2.v2 [package]

Definition at line 24 of file VreemdeEend2.java.

int VreemdeEend2.v3 [package]

Definition at line 24 of file VreemdeEend2.java.

int VreemdeEend2.v4 [package]

Definition at line 24 of file VreemdeEend2.java.

int VreemdeEend2.volgorde[] = {1,2,3,4} [package]

Definition at line 26 of file VreemdeEend2.java.

int VreemdeEend2.vraagnummers[] [package]

Definition at line 27 of file VreemdeEend2.java.

String [] VreemdeEend2.Vragen [package]

Definition at line 25 of file VreemdeEend2.java.

int VreemdeEend2.xsize = 680

Definition at line 18 of file VreemdeEend2.java.

Definition at line 18 of file VreemdeEend2.java.

Color VreemdeEend2.zwart = new Color(0,0,0) [package]

Definition at line 30 of file VreemdeEend2.java.


The documentation for this class was generated from the following file: