For decades, New Jersey’s congressional and U.S. Senate primary elections were typically low-drama affairs. But this year’s dozen contests involve considerable intrigue.

Among the unexpected factors in the June 4 contests: the corruption trial of Senator Robert Menendez, who bowed out of the Democratic primary but has suggested he might run as an independent in November; and a court ruling that forced Democrats to redesign election ballots across the state.

Seven candidates are vying to replace Senator Menendez, a Democrat who is standing trial in Manhattan. And his fate has had considerable impact on two down-ballot races as well. In the Eighth Congressional District, a freshman congressman — Senator Menendez’s son, Representative Rob Menendez — is facing strong competition when he had been expected to coast to a second term. And in the Third District, a pair of former political allies are fighting for the House seat that became open when the incumbent, Representative Andy Kim, jumped into the Senate race.

The ballot design ruling will affect every Democratic primary in the state, after a federal judge barred the party from using a longstanding layout called “the line,” which gave prominent placement to candidates endorsed by party leaders. (Republicans, who were not party to the lawsuit that led to the decision, are free to continue using it.)

The ruling was hailed by watchdog groups and scholars, who said the century-old design, used in New Jersey and no other state, violated constitutional rights.

The June 4 primary will be the first election since the ballot ruling. New Jersey voters will consider Democratic and Republican candidates for the Senate as well as 11 of 12 congressional seats. (In the Tenth House District, a special primary will be held on June 16 and a special general election on Sept. 18, to finish the term of the late Representative Donald M. Payne Jr. of Newark.)