Using MouseX in processing to control LEDs. Error in code - LEDs remain off
lightsOn=byte(mouseX);


A byte can be any number from -128 to 127 (Java has no concept of "unsigned" values). The Arduino will reinterpret that as a value from 0 to 255.

if (data&gt;300)


255, the maximum value, can never be more than 300 - so this will always fail.

You need to re-think what data you are sending and how you want to send it.