Take Airtrain from your terminal to Jamaica Station, then E subway or LIRR to Penn Station. There take either Amtrak (NE Regional) or NJ Transit (NE Corridor) train to Trenton. Amtrak is more expensive but makes only a few stops between NY and Trenton, NJ Transit makes all stops in between.
Take Airtrain from your