ColdFusion MX Professional Projects
The remainder of this chapter and all of Chapter 6 are devoted to Screen and its subclasses, which is the left branch of the hierarchy shown in Figure 5-1. Screen is the base class for all classes that represent generalized user interfaces.
Canvas, by contrast, is a base class for specialized interfaces, such as those for games. Canvas will be fully covered later, in Chapter 9.
In the coming sections, we'll explore each of Screen's child classes. Here, I'll briefly describe what all Screens have in common: a title and a ticker. The title is just what you expect: a string that appears at the top of the screen. A ticker is simply a bit of text that scrolls across the top of a Screen, named after old-fashioned stock tickers.
The title is a text string displayed at the top of the screen. As you saw in Figure 5-3, the title of the screen is "TextBox." Subclasses of Screen have constructors that set the title, but the title may also be accessed using the following methods:
public void setTitle(String newTitle) public String getTitle()
The ticker is just as easy to access:
public void setTicker(Ticker newTicker) public Ticker getTicker()
The Ticker class is a simple wrapper for a string. To add a ticker to a screen, then, you would do something like this:
// Screen s = ... Ticker ticker = new Ticker("This is the ticker message!"); s.setTicker(ticker);
Figure 5-5 shows a ticker in action. The full text of the ticker is "A ticker scrolls slowly."
Team-Fly |