20.1. Creating a Status Bar
One limitation of the Sketcher program as it stands is that you have no direct feedback on what current element type and color have been selected. As a gentle start to this chapter, let's fix that now. A window status bar at the bottom of an application window is a common and very convenient way of displaying the status of various application parameters, each in its own pane.
You can make up your own class, StatusBar, for example, that will define a status bar. Ideally you would design a class for a generic status bar and customize it for Sketcher, but as space is limited you'll take the simple approach of designing a class that is specific to Sketcher. The JPanel class would be a good base for the StatusBar class since it represents a panel, and you can add objects representing status bar panes to it. You can use the JLabel class as a base for defining status bar panes and add sunken borders to them for a distinct appearance.
Let's start with a status bar at the bottom of the Sketcher application that contains two panes to show the current element type and color. Then the user will know exactly what they are about to draw. You can start by defining the StatusBar class that will represent the status bar in the application window, and you'll define the StatusPane class that defines a region within the status bar as an inner class to StatusBar.
Try It Out: Defining a Status Bar Class
Here's an initial stab at the definition for the StatusBar class: