I want to control a relay with a button press from a joystick using Game Control Plus and Arduino

Just noticed this discussion so sorry in not replying earlier.
The first thing to do is check whether Processing is detecting the joystick-button press. Modify the user input function to

public void getUserInput() {
  trim = vkb.getButton(“TRIM”).pressed();
  println("TRIM pressed " + trim);
}

When you run the sketch does it flip between true and false when you press and release the button?

If it does then the problem is in how you process the input.

I noticed in the draw() method the following statement

if (trim)
  arduino.digitalWrite(10, Arduino.LOW);
else
  arduino.digitalWrite(10, Arduino.HIGH);

So trim is true when the button is pressed and false otherwise. Now draw() is executed approximately 60 times a second so when you press and release the button trim is only true for a fraction of a second so the statement arduino.digitalWrite(10, Arduino.HIGH); is executed almost all the time so it will appear that the button has not been pressed.