Henry Fonda, 77, a well-loved actor whose film and stage roles helped define the ideals of steadfast courage and quiet decency for three generations of Americans, died of heart and lung ailments yesterday at the Cedars-Sinai Medical Center in Los Angeles.

Lanky in build, downright in manner, quiet, quintessentially American in the flat Midwestern accents of his speech, Mr. Fonda became a star with his first Hollywood role, "The Farmer Takes A Wife" in 1935 with Janet Gaynor. If his skill as an actor or his place in the hearts of the public ever were in doubt, both were made secure by his last film, the widely acclaimed "On Golden Pond," which appeared last year.

Mr. Fonda played Norman Thayer Jr., a retired professor who struggles to come to terms with his life and approaching death. Katharine Hepburn played his wife, Ethel, loving, wise and supportive, and Jane Fonda their daughter, Chelsea, liberated, fortyish and uncertain of herself and with whom he is seeking an accommodation after years of a difficult relationship.

For his performance, Mr. Fonda won the Academy Award for the best actor of the year. In 1981, he won a special Academy Award for the body of his work, which included more than 80 movies.

In the course of his career, Mr. Fonda spent long stretches on Broadway. Among the most successful was more than three years in the title role of the play "Mr. Roberts," for which he won the Antoinette Perry award for best actor of the 1947-1948 season. He also starred in the film version of the same work.

In Hollywood, Mr. Fonda portrayed southerners, cowboys, outlaws, comics, woodsmen, sophisticated leading men, and, in more recent years, aging professors, sheriffs and politicians. Whether memorable or forgettable, most of his parts had in common a basic quality of fairness. Mr. Fonda brought to them an intelligence and care that were widely admired by his colleagues and critics as well as by the public.

In addition to "Mr. Roberts," which appeared in 1955, and "On Golden Pond," his best films included "The Trail of the Lonesome Pine" (1936), the first Technicolor movie and an immense success; "Jezebel" (1938), which also starred Bette Davis; "Jesse James," "Young Mr. Lincoln" and "Drums Along the Mohawk" (all in 1939); "The Grapes of Wrath" (1940), a classic based on the John Steinbeck novel and for which Mr. Fonda received an Academy Award nomination; "The Ox-Bow Incident" (1943), a western classic about the lynching of innocent men; "Fort Apache" (1948), in which he gave a notable performance as an Army officer bent on discipline; "War and Peace" (1956), which provoked a remark that Mr. Fonda appeared to be the only actor who had read the book; "Twelve Angry Men" (1957), a story about a jury that Mr. Fonda produced and starred in; "Fail Safe" (1964), in which Mr. Fonda played the president, and "The Cheyenne Social Club" (1970), a film about two cowboys who inherit a cathouse and which costarred James Stewart, Mr. Fonda's closest friend. Mr. Fonda also had brief roles in such films as "The Longest Day" and "Midway."

His Broadway roles included a tour de force in "Clarence Darrow," in which he was the only actor and which was repeated on television. His last part was the lead in "Summer Solstice," a film made for television that was aired in 1981.

Mr. Fonda never attended an actor's school, believing that his profession could best be learned on the stage. In this sense, his career was classical. He began in 1925 with the Omaha Community Playhouse in in a production of Philip Barry's "You and I." The person who persuaded him to try what was to become his life's work was Dorothy Brando, the mother of actor Marlon Brando.

From 1928 through the summer of 1932, he appeared with the University Players at Falmouth, Mass. The company, one of whose founders was Joshua Logan, played in Baltimore during the winters. Others who acted in it were Margaret Sullavan, who as to become Mr. Fonda's first wife, Stewart, Mildred Natwick and Barbara O'Neil.

In those years Mr. Fonda also appeared with the National Junior Theater in Washington. In his early days in New York, he shared an apartment with Stewart and subsisted largely on rice. He got his first major Broadway role starring opposite Imogene Coca in "New Faces" in 1934. In that year, he also signed a contract with Walter Wanger to make two films a year for $1,000 a week.

In an interview with Playboy Magazine in 1981, Mr. Fonda said that he did not seriously consider becoming an actor until he tried it.

"I was a painfully self-conscious, shy young man and had very little to say," he said. "I didn't think about words at all. Part of the whole attraction of acting was that it was therapy. I was wearing a mask. It was like hiding behind a character. I wasn't self-conscious at all in the theater playing a part.

"It was very gradual that the acting thing became a pull. What I was doing was acting with all these fun people. I began to realize that acting was a game of make-believe: let's pretend. Like a young kid playing cops and robbers, cowboys and Indians. That's when I began not to think about becoming an actor but understanding what it was that is so exciting about acting. And it's still the fun that it was 56 years ago. It's still make-believe."

In the same interview, Mr. Fonda described his first trip to New York, when he saw nine plays in six days.

"One play I'll never forget was 'Gods of the Lightning,' about Sacco and Venzetti. Charlie Bickford was in it. It was so real that I walked out of the theater and scowled at the cops. I'll never forget it as an experience.

"I totally forgot that they were actors. I very quickly realized there was a difference between watching an actor you knew was acting and watching somebody who made you forget he was an actor. I began thinking, 'That's the way I want to be. Please, God, don't let them see the wheels go around, don't let the machinery show.' Whatever I do in preparation is to make it as natural and real as possible."

Largely because of the limitations he felt were imposed upon him by his speech, he avoided Shakespeare and similar classics that did not have an American setting.

Such was the naturalness of Mr. Fonda on stage and screen that the public tended to transfer the attributes of his roles to Fonda the man. Indeed, if he often played heroes, his private life included incidents that tested courage as much as anything he did in his work. For many years he was was closer to his adopted daughter, Amy, than he was to either of his natural children, Jane and Peter Fonda. He was married five times. His second wife, the former Frances Seymour Brokaw and the mother of Peter and Jane, committed suicide in 1950 as the result of a mental illness.

Mr. Fonda often bemoaned his shyness and he feared rejection by the public. In an interiew with The Chicago Tribune this summer, Katharine Hepburn said, "Henry is a very private man. In the mornings before we were shooting, I used to see him walk very quietly by himself to the pond to go fishing. He always reminded me of a little train, chugging along by himself."

Henry Jaynes Fonda was born on May 16, 1905, in Grand Island, Neb. His father was William Brace Fonda, who owned a printing shop in Omaha, and his mother was Herberta Jaynes Fonda. His forebears came to this country in the 17th century.

When he was 14, young Fonda witnessed from the window of his father's office the lynching of a black man in downtown Omaha, an incident that made a deep impression on him. He studied journalism at the University of Minnesota and held a number of odd jobs before turning to the stage.

His marriage to Margaret Sullavan took place on Christmas Day in 1931. Two months later she left him. He married Miss Brokaw in 1936. His third wife, whom he married in 1950, was Susan Blanchard, with whom he adopted Amy Fonda. Miss Blanchard was the stepdaughter of Oscar Hammerstein II, a producer. His fourth wife was Afdera Franchetti, an Italian countess. They were divorced in 1962. In 1965, he married Shirlee Adams, a former airline stewardess.

Mr. Fonda came to take great pride in the careers of his children. Amy studied to become a psychologist. Peter and Jane made careers in films and Jane has won two Oscars. But highly publicized aspects of her private life and her involvement with the antiwar movement during the Vietnam years and in behalf of women were said to have strained the relationship between father and daughter. Beyond that, Mr. Fonda has said that the demands of his profession often made it impossible to fulfill the role of father as he would have liked.

According to one account, Peter Fonda largely avoided his father until about five years ago, when he telephoned him and blurted out, "I love you." The coming together of Norman Thayer and his daughter, Chelsea, in "On Golden Pond" is said to have mirrored the end of a troubled period in the relationship between Mr. Fonda and his daughter.

For himself, Mr. Fonda maintained that life had been a good and satisfying and that he wished to be remembered as an actor. He made this point in "Fonda, My Life," which he wrote with Howard Teichmann and which was published in 1981. His hobbies included gardening and painting (he was noted for his delicate still-lifes). In 1978, the American Film Institute gave him its Life Achievement Award and in 1979 he was honored by the Kennedy Center in Washington.

In addition to his wife and children, survivors include several grandchildren.

When he received the Academy Award for "On Golden Pond," Mr. Fonda was in a hospital. As the announcement was made that he finally had won the honor that had eluded him for so long, tears sprang to his eyes and he said: "I am so proud."