Here the Processing program. I modify it to make it work with the joystick that I have on-hand -- Tandy deluxe joystick. The only file was not modify is the class file DisplayItems. That file work fine.
here is the Processing file : Compile and Tested.... Work with the Arduino program post before.
/*
*Â pa_Joystick
*Â
*Â A drawing program, the cursur is controlled by a joystick or two potentiometers.
*Â Use keys to control the following functions:
*Â 'ENTER' to start/stop drawing
*Â 'BACKSPACE' to clear the screen
*Â 'C' to switch between red/green/blue as drawing colors
*Â '+' and '-' to increase/decrease stroke weight
*
*Â This file is part of the Arduino meets Processing Project.
*Â For more information visit http://www.arduino.cc.
*
*Â copyleft 2005 by Melvin Ochsmann for Malm? University
*
* Modify by Serge J Desjardins aka techone / tech37
*/
// importing the processing serial class
 import processing.serial.*;
// the display item draws background and grid
 DisplayItems di;
// definition of window size and framerate
 int xWidth = 512;
 int yHeight = 512;
 int fr = 24;
// attributes of the display
 boolean bck = true;
 boolean grid = false;
 boolean g_vert = true;
 boolean g_horiz = true;
 boolean g_values = false;
 boolean output = true;
// variables for serial connection, portname and baudrate have to be set
 Serial port;
 int portname =3; // <-- change this number to your port number
 int baudrate = 9600;
 int value = 0;
 int lf=10; // <-- I add that variable
Â
// buffer and value variable for each value and boolean to switch between values
 String bufA="", bufB="";Â
 boolean buf; // boolean switch to distinguish values
 int value1, value2; // value1, value2 that then are passed on to xpos and ypos
// variables for drawing function
 int xpos, ypos;
 int prevX, prevY;
 boolean paint = false;
 int curCol = 1;
 int strWght = 1;
Â
// lets user control DisplayItems properties, value output and drawing attributes
void keyPressed(){
 if (key == 'b' || key == 'B') bck=!bck; // background black/white
 if (key == 'g' || key == 'G') grid=!grid; // grid ON/OFF
 if (key == 'v' || key == 'V') g_values=!g_values; // grid values ON/IFFÂ
 if (key == 'o' || key == 'O') output=!output; //turns value output ON/OFF
 if (keyCode == ENTER) paint=!paint; // enter turn paint ON/OFF
 if (keyCode == BACKSPACE) clear(); //backspace clears screen
 // + and - increase/decrease stroke weight
 if (key == '+') { if(strWght == 5){strWght = 5;}else{strWght++;}}
 if (key == '-') { if(strWght == 1){strWght = 1;}else{strWght--;}}
 // c switches colors between red/blue/green
 if (key == 'c' || key == 'C') { curCol++; if(curCol > 3)curCol=1; };
}
void setup(){
 // set size and framerate
 size(xWidth, yHeight);
 frameRate(fr); // The original was bad, I change it
 // establish serial port connection  Â
 port = new Serial(this,Serial.list()[portname], baudrate); // also the original was bad. I change that to
 println(Serial.list()[portname]);
 // create DisplayItems object
 di = new DisplayItems();
 xpos=xWidth/2; // That was missing
 ypos=yHeight/2; // That was missing
 port.bufferUntil(lf); // The routine serialevent() need this statement, I add that line
}
void clear(){
 background( (bck) ? (0) : (255) );
}
void drawLine(int x, int y, int px, int py){
 line(x, y, px, py);
}
void drawCursor(int x, int y){
 background( (bck) ? (0) : (255) );
 stroke( (bck) ? (255) : (32) );
 strokeWeight(1);
 line(x-(width/128), y , x+(width/128), y );
 line(x, y-(width/128), x, y+(width/128) );
}
// reads the serial events, stores events in buffer and asigns values
// Sorry PaulS, I did not change that, I keep it as is.
void serialEvent(int serial){
 if(serial!=10) {  Â
   if (serial=='X') buf = true;
   if (serial=='Y') buf = false;
   if (buf){ if (serial!='X') bufA += char(serial);
        }else{
        if (serial!='Y') bufB+= char(serial);
        }
   } else {
        if (buf){ value1 = int(bufA); bufA="";
        } else { value2 = int(bufB); bufB="";
        }
   }  Â
}
void startDrawing(){
 if (!paint) { drawCursor( xpos, ypos ); }
 if (paint) { strokeWeight(strWght); drawLine( xpos, ypos, prevX, prevY ); }
}
void draw(){
// set previous x and y position to current x and y position
 prevX=xpos;
 prevY=ypos;
// listen to serial port and trigger serial event Â
 while(port.available() > 0){
    value = port.read();
    serialEvent(value);
 }
// read values 1 and 2 and transform in x and y position
Â
 xpos = int(map(value1,0,1023,0,xWidth)); // The cursor was not center properly
 ypos = int(map(value2,0,1023,0,yHeight)); // I simply change it to a map() function
// paint background if paint is false           Â
 if(!paint) di.drawBack();
// set color if paint is true
 if(paint){
  switch(curCol){
    case 1: stroke(255, 0, 0); break;
    case 2: stroke(0, 255, 0); break;
    case 3: stroke(0, 0, 255); break;
    }
 }
  // begin drawing and drawItems
 startDrawing();
 di.drawItems();
 println("xpos: "+xpos+" - ypos: "+ypos); // To monitor what is going on. The original was "not proper"
}