The president noted that he attended the dedication of the George W. Bush Presidential Library and Museum a few days earlier and said that he was beginning to think about his own. He said he was contemplating putting up a structure next to Mr. Bush’s, then showed a picture on a video screen of the Blame Bush Library, with a billboard pointing to the new library in Texas and the words “His Fault.”

Mr. Obama expressed some frustration with critics who suggest that he should be more effective, singling out a column by Maureen Dowd of The New York Times that compared him unfavorably with the fictional commander in chief in “The American President,” a movie starring Michael Douglas. Noting that Mr. Douglas, who played the title character, was in the audience, Mr. Obama jokingly asked for advice.

“Michael, what’s your secret, man?” he asked. “Could it be you were an actor in an Aaron Sorkin liberal fantasy? Could that have something to do with it? I don’t know. Check in with me.”

The president also poked fun at himself. Recalling that he was criticized for saying that Kamala Harris of California was the country’s best-looking attorney general, he said: “As you might imagine I got trouble when I got back home. Who knew Eric Holder was so sensitive?”