• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. SWT Text Fields > Adding Text Fields to a Shell

5.1. Adding Text Fields to a Shell

As with all of the SWT widgets, text fields must be added to a container object—an instance of Shell, Composite, or Group.

5.1.1. How do I do that?

Two coding steps are required to create a text field and add it to a window. First, create an instance of the Text class, passing the Text constructor a reference to the Shell and the desired style attribute(s). Second, specify the location of the text field within the container and set its width and height. Example 5-1 demonstrates how to add a text field to a window.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint