Processing code for arduino

Dear all,
I am trying to processing code with arduino UNO.I tried with VB but seems data not being updating, But in processing the i tried below code where i can get serial data. Now i wanted to create button Which activate and deactivate relay like in VB, Is it possible to create in Processing.
I tried simple example code coming With processing But i could not able to control output. SO let me know Where i can find More example for digital io control and processing software.

I have attached Both image and link for references

http://forum.arduino.cc/index.php?topic=267122.msg1885398#msg1885398
Processing code

import processing.serial.*;
Serial myPort;
String sensorReading="";
PFont font;
int val = 0; 

void setup() {
  size(400,200);
  myPort = new Serial(this, "COM3", 9600);
  myPort.bufferUntil('\n');
  font = createFont(PFont.list()[2],32);
  textFont(font);
}

void draw() {

}
void serialEvent (Serial myPort){
 sensorReading = myPort.readStringUntil('\n');
  if(sensorReading != null){
    sensorReading=trim(sensorReading);
  }

  writeText("Current_Reading: " + sensorReading);
}


void writeText(String textToWrite){
  background(255);
  fill(0);
  text(textToWrite, width/20, height/2);   
}

Arduino COde

#include <MsTimer2.h>
int Analog_Pin=5;
int newaverage;
float Output_Current;
#define RELAY1  7
int Serial_Status=0;



void TakeReading()
{
  newaverage = analogRead(A5);
  Output_Current = 0.0336666666667*newaverage - 17.17; 
}


void setup()
{
  Serial.begin(9600);
  MsTimer2::set(1000, Print_Result); // 500ms period
  MsTimer2::start();

}

void loop()
{
  TakeReading(); 

  int val = Serial.read() - '0';
  if (val == 1) 
  { 
    digitalWrite(RELAY1, LOW); // turn on LED

  }
  else if (val == 0) 
  {

    digitalWrite(RELAY1, HIGH); // turn off LED

  }
  delay(500);
}

void Print_Result()
{
 // Serial.print("Output_Current:");
  Serial.println(Output_Current);

}

There are a few add on libraries for processing that give you buttons etc. Have a look here for one version.