home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Sams Teach Yourself Visual J++ 6 in 21 Days
(Publisher: Macmillan Computer Publishing)
Author(s): Rick Leinecker
ISBN: 0672313510
Publication Date: 11/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Q&A

Q How do you add a label to your form?

A The first thing you do is create a Label control. You do this with the new operator. Normally, your Label control will take a single argument in its constructor. That single argument will be the text that will appear in the control. However, you don’t have to worry about manually creating a Label control and adding it to your form. The Properties window will do everything for you.

Q What kinds of events do Edit controls offer?

A They offer most of the standard events, such as double-click, drag drop, drag enter, drag leave, and drag over. Some of the specific events they offer that you’ll be interested in are the key down, key press, and key up events. One additional event you’ll be interested in is the text changed event. This is triggered when the text property for this control changes.

Q What is a RichEdit control, what can it be used for, and why does it make your job as a Visual J++ programmer easier?

A The RichEdit control contains formatted text. Unlike the Edit control and the TextArea control, it supports font selection, boldface, and other type attributes. You can easily use this control to create a simple text editor or word processor as part of your application. This control takes the pain out of creating word processors because all you have to do is put up the control and respond to several events.

Exercises

1.  Create a program and add a label at the top. Below that label, add an Edit field. In the Edit field, respond to the textChanged event by changing the text in the label to reflect what’s in the Edit field.
2.  Create another program with a label at the top. Below this label, create a list box. Add eight items to the list box. Then add an item event handler for the selectIndexChanged() method. Respond to this event by changing the text in the label after users make selections in the list box.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.