The best reference online is Sun's java page. This is also how where you can download the development environment used in recitation for free. Just look for the pages about the JDK (java development kit).
It was reported that there are other tools for doing java on Athena, thought I have not tried them out myself. The incantation on Athena is:
add java add studio js add workshop jws
g.setColor(new Color(0.5f, 0.5f, 0.5f)); g.drawLine(0, 0, w, h); g.fillRect(0,0,w,h); int myArray[] = new int[10]; int i; for(i=0;i<10;i++) { myArray[i] = i; } if(t < 0.5) { g.setColor(Color.black); } else { g.setColor(Color.white); } int j=0; while(j<10) { g.drawLine(0,0,w,j*10); j = j+2; } float f = (t+0.1f); do { g.drawLine(w,h,(int)(f*w),(int)(t*w)); f = f*2; } while (f < 1.0); float q = t; q = (float)Math.sin(q); q = (q+1.0f)/2.0f; g.setColor(new Color(q,q,q));
public void draw(Graphics g, float t) {
Just remove the few lines that are there and add your own commands. If you make new variables before this draw line, they will keep their value throughout the program, variables made after this draw line will be created new each time.
Along with any variables you make, you also have access to the following three variables:
int w = the width of your canvas
int h = the height of your canvas
float favoriteFrame = your favorite value of t, in case we take a snapshot.
Note that you should not reset w and h, but you should reset favoriteFrame if you desire. That is:
Dont do this: w = 200
But feel free to do this:
favoriteFrame = 0.65f
t = t % s;So for part three, which asks for you to animate over 1.5 seconds and repeat the animation continuously, you could just add the following line to the beginning of your draw method:
t = t % 1.5f;Of course, if you want to be more fancy (and add a delay at the end or whatever), that is completely up to you.