Thank you for visiting Blazing Games

awt

The basic Java user interface classes are known as the Active Window Toolkit or awt. This class library was designed to use the native operating system's user interface but in a platform independent way. While this works, newer user interfaces, such as swing, are pure java (well, as pure as is possible). The problem with swing is that at the time this is being written a certain monopoly does not support swing in it's browser.

With awt, all your standard windows components (labels, text boxes, buttons, checkboxes, radio buttons, scrollbars, and so on) are available. In fact, it is possible to use the frame class to create a new window. Applet frames will have a warning in the bottom of the frame to prevent panels from being used as trojans. Layout in awt is through a layout manager. It is also possible to draw directly to the initial window. The only thing different about the applet's initial frame and the frame class is the lack of a menu.

Java has limited font support. In fact, Java only has 5 different typefaces. While this may seem limited, fonts can be any size, as well as have bold and/or italic attributes applied to it. Information about fonts can be found with the font metrics class, which we will use to properly position text in our applet.

Color in java is 32 bit, with 8 bits for red, 8 bits for green, 8 bits for blue, and 8 bits for the alpha channel. The alpha channel is the transparency of the color. The color values are unsigned, meaning that each of the colors range from 0 to 255 (resulting in 16 million combinations). 0 is used to indicate the darkest possible value while 255 is the brightest. Those of you who are use to paint may be a bit confused about the colors, as computers deal with light. Yellow is created by mixing green and red. One suggestion is to use a paint program to work out the value of the colors. Many paint programs offer different ways to make a color, so you can create a color using a technique you know and then use the rgb values for the actual color.

Previous Chapter 4 Contents Page 7 of 10 Book Contents Next

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2003-2006 Blazing Games Inc. All Rights Reserved