Java 1.4 Game Programming (Wordware Game and Graphics Library)

Before we talk about heavyweight and lightweight components, we should mention briefly what components are. A component is an object used to represent an area of the screen, which can also be used to handle events. An example of a component is a button, which has a screen presence and can accept mouse events to click the button (or even keyboard events for that matter). A container is an extension of a component, whereby it is itself a component, with the ability to contain other components (children). For example, a button component would be placed inside a container, such as an applet. A button is not a container, however, as it cannot contain other components (i.e., you wouldn't add a text field to a button). We will look at components and containers in detail in the next chapter, "Graphics" and in Chapter 13, "Introduction to GUI," where we will make our own hierarchical component container GUI system. For now, we will just make our first applications windows and applets.

Категории