CHAPTER 10
GRAPHICAL USER INTERFACES 
CHAPTER GOALS
To implement simple graphical user interfaces
To add buttons, text fields, and other components to a frame window
To handle events that are generated by buttons
To write programs that display simple drawings
CHAPTER CONTENTS
Special Topic 10.1: Adding the main Method to the Frame Class
10.2 EVENTS AND EVENT HANDLING
Common Error 10.1: Modifying Parameter Types in the Implementing Method
Common Error 10.2: Forgetting to Attach a Listener
Programming Tip 10.1: Don't Use a Frame as a Listener
Special Topic 10.2: Local Inner Classes
Special Topic 10.3: Anonymous Inner Classes
Common Error 10.3: Forgetting to Repaint
Common Error 10.4: By Default, Components Have Zero Width and Height
How To 10.1: Drawing Graphical Shapes
Worked Example 10.1: Coding a Bar Chart Creator ![]()
Video Example 10.1: Solving Crossword Puzzles ![]()
In this chapter, you will learn how to write graphical user-interface applications that contain buttons, text components, and graphical components such as charts. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access