- Using Visual J++ -

Chapter 13

Utilizing Pre-Defined Classes


In this chapter, you will learn how to use many of the pre-defined classes that come with Visual J++. The pre-defined classes let you minimize your code so that you can concentrate on your program's primary goals and let the pre-defined classes handle the tedious details such as manipulating string data, calculating mathematical results, getting end-user input, and supplying output.

Finally, this chapter teaches you how to add powerful input- and output-based controls to your programs. These controls will be familiar to Windows users. All the standard labels, text boxes, buttons, check boxes, and radio buttons work the way you're used to seeing them work inside Windows-based applications. The methods supplied with these pre-defined I/O classes also let you work with the controls and manipulate them interactively as your programs require.

The Pre-Defined Classes

As you know, the import command brings in pre-defined class packages for you. These class packages do all kinds of work for you so you don't have to write code that Visual J++ supplies. These pre-defined classes provide math, string, and input/output (I/O) capabilities.

As you learned from chapter 12, "Working with Classes," classes contain both data members and methods. When you utilize a class that someone else wrote, you can access the data and methods that are available to you. Generally, you'll subclass a pre-defined class meaning that you'll inherit, or derive, your own classes from the pre-defined classes and instantiate objects of the derived class to use in your own programs.

 
Chapter 19, "Visual J++ Applet and AWT Class Reference," presents you with a comprehensive pre-defined class listing that contains methods and data members that you can use in your programs. This chapter will teach you about using the pre-defined class packages in your programs. Once you learn how to use the classes described here, you'll be able to access the class reference described in chapter 19.

Not all pre-defined classes need you to import them with import. For example, you can use the String, math, and standard I/O classes, described in the next three sections, without specifying their respective class packages in an import statement.

The String Class

The String class offers many string-handling features you can use in your programs. String variables require a string class because Java supports no built-in string data type. Whereas Java supports integer, floating-point, and character variables, Java does not support string variables directly. When you use the String class, however, you can manipulate strings almost as easily as if they were a built-in data type.

 
Of course, Java does support string literals as you learned in chapter 10, "Java Language Fundamentals."

The String class appears in the java.lang class package. Java.lang derives from a common Java object so you don't explicitly have to import the java.lang class package. Therefore, you can use the String class in any program that you write with Visual J++.

The String class lets you create fixed string variables. The word "variable" is misleading because once you define a string, you cannot change the string. Therefore, the following two lines define and initialize two variables:


int x = 9; // The value can change
String s = "Que"; // The value cannot change

Later in the code, you can change the value of x like this:

x = 12;

you cannot, however, change s like this:

s = "A new string"; // Not allowed!

s is a string object, not a regular variable. The assignment operation is not defined for the String class so you cannot change a string with an assignment.

You might wonder why the new keyword is not used when defining String objects. Actually, you can use new to define String objects like this:

String s = new String("Que"); // Instantiates a new string

Both instantiation devices end up doing the same thing. The instantiation that does not use new, however, is more efficient. The default constructor called requires less overhead than the new-based version. Therefore, most Visual J++ programmers instantiate Java String objects without using the new command.

The String class supports great string-management methods. The String class's obvious drawback is that you cannot change a string's value. Therefore String objects are often called read-only objects. Despite its fixed nature, when you need to work with fixed string variables, the String object produces the most efficient string-management class available to you.

 
Visual J++ supplies the StringBuffer class with which you can create and change strings almost as though the StringBuffer strings were true variables. The next section describes the StringBuffer class.

Several String class string-comparison methods exist that return a boolean result. Due the boolean return result, you can use the String methods inside if, while, and do statements to make controlling decisions and to control loops.

Use the equals method to determine if one string is equal to another. equals() is case-sensitive, so the string "HELLO" will not compare equal (equals() will return false) to the string "Hello" due to the case differences. Here is an if statement that uses equals():

if (firstName.equals("Nancy"))

The firstName must be a String object that you've defined before the if statement. equals() is the method applied to your firstName object. Java compares firstName's parameter, Nancy" (a string literal), to your String object and returns a boolean true or false result.

The equals() parameter can be either a string literal or another String object. All of the String methods accept either String objects or string literals. You can use the equals() method anywhere you need to test for a true or false comparison.

If you want to ignore the case within the two strings, use the equalsIgnoreCase() method. The following while loop is based on a string comparison that ignores the case:

while (password.equalsIgnoreCase(tryThisPassword))

The toLowerCase() method returns the string converted to all lowercase letters. The following if statement performs a nested String method call. The equals() method uses the result of the toLowerCase() method to test for a lowercase answer

If ( (answer.toLowerCase()).equals("yes") )

 
If the string you pass to toLowerCase() already contains lowercase letters, toLowerCase() returns those lowercase characters without converting them.

The toUpperCase() method returns the string converted to all uppercase letters as shown here:

If ( (answer.toUpperCase()).equals("YES") )

Use the trim() function if your string possibly has leading or trailing spaces that you want to strip off the string. trim() returns the stripped string:

g.drawString("Name: " + trim(lastname), 25, 75); // Draws the stripped string

If lastName contains the string " McNeely" (leading or trailing blanks can sometimes enter into a string in certain input routines or as a result of file I/O), the trim() method strips the string of its leading spaces and draws the following string in the output window:

Name: McNeely

Several substring methods exist that let you work with substrings, or parts of strings. The substring() method returns the substring that begins at the index location indicated by the substring() method's parameter like this:

g.drawString(name.substring(6));

If name contains Sarah Beth then this substring() method pulls out the string starting at the character indexed at 6, or the string Beth and prints that substring.

 
The substring() method's index, as well as all the other String method index values, always begins at zero. Therefore, the String method starts counting at zero when determining where the substring begins.

You can use these String methods to create new String objects. The following statement defines a new string from a substring of an existing string:

String newShortString = name.substring(6); // New string holds Beth

As you can see, you can define a String object in the middle of code; the Java language does not require that you define all your code's data before any executable code appears as other languages sometimes require.

The String method named indexOf() performs the opposite action from the substring() method. indexOf() returns the index of a substring's position inside another string. Therefore, the following indexOf() method call returns 6 given the contents of name shown previously:

name.indexOf("Beth")

If you want to find the find occurrence of a character inside a string, use a character parameter for indexOf() like this:

name.indexOf('h')

 
Obviously, the String class contains overloaded indexOf() methods that let you pass a string or a character parameter. As you'll next see, the String class overloads indexOf() even further.

indexOf() as you've seen it explained so far, finds the first occurrence of a substring or character inside a string. You can also start the search at any index value. A starting index value lets you find substring locations other than the first occurrence of the substring.

The following expression locates the first occurrence of 'h' inside the name string beginning at the index value of 4 (the expression ignores all characters before the fifth character):

name.indexOf('h', 4)

The following expression locates the first occurrence of "small" inside the string named aString but does not begin the locating until the sixth character (index 5 due to the starting index value of zero):

name.indexOf("small", 5)

In addition to finding the first substring, as well as the substring beginning at a certain location, the String method can find the last occurrence of a substring or a character within a string. Use the lastIndexOf() method to locate the final occurrence of a substring or character. If the substring or character only exists once in the String object, lastIndexOf() returns the same value as indexOf(). The following expression returns the last index value of the character x as long as x resides at least once in bigString:

bigString.lastIndexOf('x')

If any of the overloaded indexOf() methods fail to find their substrings or index characters, indexOf() returns -1. Therefore, you should check for a return index of -1 to see if Java failed to find the substring.

When you want to know the number of characters in a String object, use the length() method as shown here:

size = myName.length(); // Stores size of myName

 
When you define a string from an unknown source, such as from a file that you're reading, you could end up with a string that you don't know the contents or the size of. To ensure that you can display the string inside a window, you might want to check a string's length before displaying the string.

Again, you'll learn in the next section how to use the StringBuffer class to change string values. The String-based methods are read-only methods. That is, you can test and return parts of strings but you cannot change a String object. Well, that's not necessarily true! Through an internal trick, the Stirng class does contain one method that lets you add a string to another String object.

Use concat() method (for concatenation) to add a string to the end of another String object. The following expression expands aString from its original value to a larger concatenated value by concatenating extra to the end of aString:

aString = aString.concat("extra);

You can concatenate additional strings in one expression like this:

aString = aString.concat("First").concat("Second").concat("Third");

The method's dot operator associates from left to right. Therefore, once this assignment finishes, aString contains its original string plus the concatenated string FirstSecondThird.

The StringBuffer Class

If you want efficiency and powerful string-comparison methods, use the String class as much as you can. As you now know, however, the String class does not let you change a String object except when you concatenate to that String object. Visual J++ supplies the StringBuffer class to give you a changeable StringBuffer object. Not only can you change a StringBuffer string but you can replace a StringBuffer's string object variable with a longer or shorter string; the StringBuffer class will take care of expanding or shortening the data's length.

 
The StringBuffer class appears in java.lang so you don't have to import a class package to use StringBuffer. The Visual J++ compiler always imports the java.lang class package for you.

The StringBuffer Constructors

The StringBuffer class supports three constructors depending on the initial string you want to instantiate. If you know the StringBuffer object's initial value, construct a StringBuffer string object like this:

StringBuffer myString = new StringBuffer("This is the initial value");

This constructor constructs a myString object that holds the string This is the initial value, which is 25 characters long.

 
C and C++ programmers should notice that Java-based strings have no terminating zero included in the string length. Although Java might represent strings internally with the terminating zero, you, as the programmer, can assume the terminating zero is not part of the string. You never have to worry about Java's string-terminating characters.

If you know the approximate string's length but don't know the string's initial contents, you can create a StringBuffer object of an initial size. The following StringBuffer constructor instantiates a string that's 18 characters long (the contents are unknown, however):

StringBuffer myString = new StringBuffer(18);

 
If you read fixed-length disk data into a string, you'll know the record size so you also know the string size you need. Strings that hold disk record data make excellent candidates for the StringBuffer's instantiation of a string object defined to an initial length. When you define a string that approximates your needed string's size, you'll improve your program's runtime efficiency because Visual J++ will not have to expand the string at runtime to hold the initial value.

If you know that you'll need a string variable but you don't know the initial value and you have no idea how large the string will need to be, you can instantiate a StringBuffer object that's a null or empty string like this:

StringBuffer myString = new StringBuffer(); // An empty string

Your program can then store myString's value in myString later when you get the contents of the string.

The StringBuffer Methods

Obviously most of the StringBuffer methods deal with initializing or changing StringBuffer objects. To change a StringBuffer object's contents does take a little footwork; a simple assignment would be welcome but StringBuffer requires a little more work to change an object.

One way to change the string data contents of a StringBuffer object is to use the setLength() method to set the StringBuffer object's length to zero and then insert characters using the insert() method. Suppose myName contains the string This is the initial value. Once the following statements finish, myName contains A new string.


myName.setLength(0); // Set the string to zero (wipes out the string)
myName.insert(0, "A new string"); // "Inserts" a new string at index 1

The first statement sets the StringBuffer object's length to zero which, effectively, erases the contents of the StringBuffer object. The next statement uses the setLength() method to insert a new string at the StringBuffer's first character position (index position zero).

 
The insert() method truly inserts characters into a StringBuffer object. If you don't first set the StringBuffer object's length to zero, insert() inserts a string starting at the index's position. The StringBuffer object becomes longer by the length of the newly-inserted string.
 
 
You can find the length of a StringBuffer object by using the length() method.

If you are not sure of the length of a StringBuffer object, you can append a new value to the end of the StringBuffer object, without first finding the length of the StringBuffer object, by using the append() method. The following statement appends the string Extra to the end of myName's contents:

myName.append("Extra"); // Adds "Extra" to the string

Chapter 19 lists several more index-based search and replace methods you can use on your StringBuffer objects.

The Math Class

Visual J++ supplies several Java-based mathematical methods in the java.lang.Math class package. As with the String and StringBuffer classes, you don't need to use an import command to import the Math class package.

Most of the Math class methods provide illustrations of the class procedure-based paradigm shown in figure 13.1. You'll recall from earlier chapters that Java methods mirror the action of most programming language procedures. Procedures (and, therefore, the class methods that you use and write) accept zero, one, or more parameters and, optionally, return a single value. Almost all the Math class methods receive one or more parameters and return a single value.


FIG. 13.1

A java.lang.Math mathematical method accepts zero or more parameters and returns a calculated result.

 
If you know much about mathematical theory or other programming languages' built-in functions, you'll immediately recognize that the java.lang.Math methods mirror the classic requirements of functions that you've seen in your other work.

Mathematical Methods

Several methods return results based on numeric variables and constants that you pass to them as parameters. Even if you rarely write science and engineering Visual J++ programs, some of these methods may be useful to you.

 
Most of the java.lang.Math methods are overloaded to accept any common numeric data type.

Several methods help you round values. Due to the nature of rounding, you need more than one method depending on the type of rounding that you require. Use the ceil() method (for ceiling) to round numbers up to the closest nearest integer. The following statements store 4.000 in ans:


aNum = 3.57; // aNum is a float
ans = java.lang.Math.ceil(aNum); // ans is a double

Use floor() to round numbers down to their integer-based equivalent. The following statements store 3.000 in ans:


aNum = 3.57; // aNum is a float
ans = java.lang.Math.floor(aNum); // ans is a double

The round() method rounds according to the accepted rounding rules. If the parameter's fractional part is .5 or over, the method rounds up but if the parameter's fractional part is less than .5, round() rounds down. The following statements store 8.000 in ans:


aNum = 7.50; // aNum is a float
ans = java.lang.Math.floor(aNum); // ans is a double

 
Despite the fact that these rounding methods round to integers, their return data types are double. If you need the return values to be one of the integer data types, you can typecast the rounding methods' return values or simply assign the return value to an integer variable to implicitly convert the double return value to an integer. The java.lang.Math class package does contain one integer-returning round() method that accepts a float data type and returns an int data-typed value.

Although you can use the conditional operatior, ?:, to write your own minimum and maximum statements, you might as well save your time and use the Math class's min() and max() methods. The following statements store the smallest of two values in small and the largest in large:


small = java.lang.Math.min(a, b);
large = java.lang.Math.max(a, b);

The abs() method returns the absolute value of its parameter. The absolute value is defined as the positive equivalent of a number. For example, the absolute value of +8 is +8 and the absolute value of -8 is also +8.

 
Use absolute value for distances (which are always positive), accuracy measurements, age differences, and other calculations that require positive results.

The following statement returns the difference between two ages:

ageDiff = java.lang.Math.abs(age1 - age2); // Returns the positive difference

The sqrt() method returns the square root of the parameter. The following statement stores the square root of the value in s:

s = java.lang.Math.sqrt(value); // Finds the square root of s

The pow() method returns its first parameter raised to its second parameter's power. For example, the following statement computes 7 raised to the 3rd power:

x = java.lang.Math.pow(7, 3);

The nth Root

No Visual J++-supplied method returns a number's nth root. Sqrt() returns the square root but no other root. In other words, you cannot call a function that gives you the 4h root of 65,536. (By the way, 16 is the 4th root of 65,536 because 16[ts]16[ts]16[ts]16 = 65,536.)
You can use a mathematical trick to simulate the nth root, however. Because Java lets you use pow() to raise a number to a fractional power, you can raise a number to the nth root by raising it to the (1/n) power. For example, to find the fourth root of 65,536, you can type this:
 
root = java.lang.Math.pow(65536.0, (1.0 / 4.0));
 
Knowing how to compute the nth root comes in handy for scientific programs and also in financial applications such as time value of money problems.

Trigonometric Methods

If you need to write trigonometric-based programs, use the following methods:

These trigonometric methods require that you express their parameters in radians. If you need to pass an angle expressed in degrees, you just convert the angle's degree parameter to radians by first multiplying the degrees parameter by PI/180.0. You can use the named constant PI described later in the "Mathematical Named Constants" section.

Logarithmic Methods

Visual J++ supplies two highly mathematical methods sometimes used in business and mathematics. The functions are:

Mathematical Named Constants

The java.lang.Math class includes two named constants you can use in calculations. (Don't attempt to change these constant values.) You'll use these named constants in special mathematical operations:

The following statement computes the area of a circle given a radius defined in the variable named r:

circArea = java.lang.Math.PI * (r * r);

Generating Random Numbers

Random events happen every day. You wake up and it might be rainy or sunny. You might have a good day or a bad day. You might get a phone call or you might not. Your stock portfolio might go up or down in value.

Random events are especially important in games. Part of the fun in games is your luck with rolling dice or drawing cards, combined with your playing skills.

Simulating random events is an important task for computers. Computers, however, are finite machines; that is, given the same input, they always produce the same output. This finite nature could cause computers to give you very boring games that always produce the same play.

The designers of the Java language stole C's random-number generating method to add randomness to programs that need it. The java.lang.Math class's random() method requires no parameters. random() always returns a random number from 0.0 to 1.0. You can typecast the random return value to an integer if you wish to return an integer value.

The following statement assigns a dice roll, a number from 1 to 6, to the variable named dice:

dice = (int)(java.lang.Math.random() * 6);

 
The java.util.Random class package contains an extensive array of random-number generating methods. If you do lots of programming with random numbers, such as writing business simulations, you'll almost certainly want to check out the java.util.Random methods described in chapter 19.

Working with the Abstract Windowing Toolkit

The Abstract Windowing Toolkit (AWT) class package provides the tools you need to add labels, buttons, scroll bars, and all the other Windows-like features you've come to expect. Until now, little mention has been made about input methods. When using Visual J++ and Windows, you waste your time if you spend a lot of time learning about text-mode I/O (such as System.out.println()) because most of your I/O will take place using Windows controls.

You'll add almost all the AWT Windows-like controls to your applet's panel. A panel is a visible holding place (often called a container). Although an applet can contain several panels, your applet's primary window often serves as the primary panel on which you'll add AWT objects. To add a new AWT object to your applet panel, you'll generally follow these steps no matter which kind of object you want to add:

  1. Create a new AWT object (such as a label or button).
  2. Add the object to your panel with the add() method.

By default, your panel receives objects that are centered and those centered objects appear left-to-right and flow down the panel as you add them. You can more specifically control the placement of objects if you need to. For now, focus on the AWT object creation and panel addition methods and let Visual J++ decide how to place the objects on your panel while you master Visual J++. Once you understand the AWT objects and how to add those objects to a panel, you can concentrate on placing the AWT objects exactly where you want them to go.

Although this section will not make you an AWT master, you'll learn how to add the following Windows-control objects to your Visual J++ applets:

AWT supports many other objects, including the conglomerating dialog box objects which can hold multiple objects. Figure 13.2 shows all these AWT objects on an applet window.


FIG. 13.2

Several AWT-based objects you can add for I/O.

Select Your Font

The setFont() method lets you specify the font that you want to appear in AWT objects. For example, if you want to print a label with a special font or with a special font style (such as boldfaced or italicized characters) you can request a font, font size, and font style before creating the label.

Before using setFont(), create a font with the special Font constructor. The following code constructs and sets up subsequent output for a 14-point Courier italicized font:


Font font = new Font("Courier", Font.ITALIC, 14); // Construct the font
g.setFont(font); // Makes your font the default font for subsequent ouput

The point size refers to the height of the font's tallest characters. One point is 1/72nd of an inch, so a character printed in 72 points would be one-inch high. A typical word processor font size is generally 10- or 12-points high. Use the following named constants for the font style (the style is a pre-defined data member so you must preface the font style with Font.):

If the font name does not appear on the target system, the Web browser will substitute another font. Therefore, be sure to request standard font names so that your applets will likely find those fonts on the end-user's system.

 
The setFont() function also works to set up a font before drawString() methods as well.

Using Labels

The g.drawString() method works well for shooting text to the applet window as you've seen. The Label() method provides a more useful tool for controlling the way your output looks. A label is group of text characters that appears in a panel. You can justify a label's text and control the font used very easily.

 
The drawString() function is fine as long as you add your drawString() methods to your applet's paint() method so that your output redraws every time the applet window needs to be redrawn. Your applet automatically handles the redrawing of panel objects, however, so you have more freedom on their placement within your applet.

Once you've requested your font, add a label to your panel by constructing and adding the label like this:


Label top = new Label("This is the label's text", Label.RIGHT);
add(top); // Paints the label on your panel

You can combine these statements into one by constructing the label directly inside the add() method like this:

add(new Label("This is the label's text", Label.RIGHT));

By using the Label.RIGHT named constant, you can right-justify the label's text. Label.CENTER centers the label's text within the label and Left.LEFT left-justifies the label.

Depending on your applet and user's responses, you may want to change the text that appears on a label. Use the setText() method to change a label's text like this:

top.setText("This is new text");

You can also change the label's text alignment with the setAlignment() method like this:

top.setAlignment(Label.LEFT);

Using Text Boxes

A text box displays and accepts user text. Once you've requested information, by displaying your prompt with a label for example, your user can enter a response.

 
Generally, Windows-based programmers use the term text box whereas Java programmers on other kinds of systems refer the these data-entry objects as text fields.

The following text box methods exist for constructing and working with text boxes:

The following code asks the user for a company name and displays a text box for the user's response:


add(new Label("What is your company? "));
add(new TextField("ABC, Corp.", 25)); // The default value

The text box will initially hold a default text value of ABC, Corp. But the user will be able to change the text box to a different value.

Using Text Areas

Text areas, like text boxes, display and accept user text. The difference between text areas and text boxes is that a text area can manage much more text. If all the text will not fit in the text area borders, your Web browser will supply scroll bars for your end-user to use to read all the text in the text area.

The following text area methods exist for constructing and working with text areas:

Using Buttons

A button can give your users simple access to trigger points and cancellation notices within your applet. A button lets your user click an on-screen button to select the button. As with Windows-based buttons, an AWT button object often (depending on your browser) visually shows the user's button press for feedback.

The Button() method constructs AWT-based buttons. Use the format Button(String value) where value is the string of text that initially appears on the button.

Once you add buttons, you must add a new method to your applet to determine what the user clicks the button. Here is the method's definition line:

public boolean action(Event eventName, Object theAction)

You don't have to worry about executing this action() method because your Java-enabled browser will automatically execute the method whenever the user clicks the button (or triggers virtually any other event). It is your job to determine which button that the user clicks. This programming job includes the following requirements for the body of the action() method:

  1. Use the instanceof operator (you have yet to see the instanceof operator) to see if the event-trigger (the event's target specified with the target data method) was a button. instanceof can test for a Button object as you'll see next.
  2. Assuming your applet contains multiple buttons, the second parameter, theAction, will contain the button's label, which you should typecast to a String object, for testing.

The following action() method shows you how to test for a button press when the applet contains three buttons labeled Yes, No, and Cancel:


public boolean action(Event eventName, Object theAction)
{
if eventName.target instanceof Button) // Is this a button?
{
if ((String)theAction == "Yes")
{ handleYes(); } // Call Yes routine
if ((String)theAction == "No")
{ handleNo(); } // Call No routine
if ((String)theAction == "Cancel")
{ handleCancel(); } // Call Cancel routine
return true; // Tell calling code the event was handled
}
else
{
return false; // Tell calling code the event was not handled
}
}

Using Check Boxes

A check box an option that is either checked or unchecked. Its value represents a boolean-like true or false value so that your applet can determine if the user has clicked the check box or not.

The following methods control AWT-based check boxes:

The following code creates three check boxes and sets the initial value of the middle to checked but leaves the other two check boxes unchecked:


add(new Checkbox("Red")); // Defaults to unchecked
add(new Checkbox("Blue", null, true)); // Checked
add(new Checkbox("Green")); // Defaults to unchecked

When you're ready to process the check box values, use the boolean getState() method to se if the user has checked or unchecked a particular check box control.

 
The check box is a continuous off-and-on toggle. That is, each click of the mouse checks or unchecks the check box depending on the check box's current checked setting.

Using Radio Buttons

A radio button is either clicked or unclicked (indicated differently depending on your Web browser). Unlike check boxes, at most one radio button within a group of radio buttons can be set. That is, multiple check boxes let you make multiple choices but if you click on a radio button in a group of radio buttons, only that radio button can be selected. If you then click on another radio button (with that first button's designated group) your first radio button setting goes away.

Interestingly, the radio button controls use the same methods as the check boxes except the middle parameter of the constructor must be a unique identifier that names a group. The following methods control AWT-based radio buttons:

Once you create a new group like this:

CheckboxGroup rbGrp = new CheckboxGroup();

you can add radio buttons to the group like this:


add(new Checkbox("Red", rbGrp, false)); // Defaults to unselected
add(new Checkbox("Blue", rbGrp, true)); // Selected
add(new Checkbox("Green", rbGrp, false)); // Defaults to unselected

Summary

The goal of this chapter was to teach you how to use many of the pre-defined class packages that come with Visual J++. These classes are standard, found in most Java-based programming languages, so if you port Java-based applets and applications to Visual J++, you should have little trouble converting the code to Visual J++ code.

The pre-defined classes perform common string, mathematical, and I/O operations. The primary purpose of these supplied classes is to reduce your coding efforts. Instead of worrying about common and tedious details, leave those details to the pre-defined classes and concentrate on your program goals.

The next chapter extends your knowledge of the pre-defined AWT class package by showing you how to create and display graphics from your Visual J++ programs. You will enjoy creating graphics and displaying eye-catching lines, circles, and file-based graphic images.

Here are the points this chapter covered:


Previous Page TOC Next Page

| Previous Chapter | Next Chapter |

| Table of Contents | Book Home Page |

| Que Home Page | Digital Bookshelf | Disclaimer |


To order books from QUE, call us at 800-716-0044 or 317-361-5400.

For comments or technical support for our books and software, select Talk to Us.

© 1996, QUE Corporation, an imprint of Macmillan Publishing USA, a Simon and Schuster Company.