Using AWT Controls, Layout Managers And Menus Java Help

Using AWT Controls, Layout  Managers And Menus

This chapter continues our exploration of the Abstract Widow Toolkit (AWT).  Inflatables”the standard controls and layout managers defined by Java. It also discusses menus and the menu bar. The chapter includes a discussion of two  components: the dialog box and. the file dialog box. It concludes with   another 1601.< at event handling. Controls are components that allow a user to interact with your application various ways-for example, a commonly used, control is the push button.  lay out manage, positions components within a container. Thus, the appearance ‘ of a window is determined by a combination of the controls that it contains and the’ layout manager used to position them.  In addition to the controls, a frame window can also Include a standard style menu bar. Each entry in a menu bar activates a drop-down menu of options from which the use r can choose. A menu bar is always positioned at the top of a window. Although different in  appearance, menu bars are handled.in much the same way as are the other c controls While it is’possible to manually position components within a window, doing so  is .”quite tedious. The layout manager automates this task: For the first part of this chapter, which introduces the various controls, the default layout manager will be used. This ‘displays components in a container using left-to-right, top-to-bottom organization. Once the controls have been covered, the layout managers will be examined.’ There ” you will see how to better manage the poulticing of your controls .

Control Fundamentals

THE AW: Supports the following types of controls:
• Labels
• Push butane
Check boxes
• Choice lists
• Lists
. Scroll bars
• Text editing

These controls are sub classes of Component.

Adding and Removing Controls
‘To include a control in a window, you must add it to the window. To do this, ‘you must first.create an instance of the desired control and then add it to a window by calling add. which is defined by Container. The add( ) method has several forms. The following form  is the one that is used for the first part of this chapter: Component add(Component ) ”
Here,  is an instance of the control that you want to add. A reference to .is returned. Once a control has been added, it will automatically be visible. whenever its parent window is displayed.
Sometimes you will want to remove a control from a window when the control is
. no longer needed. To do this, call removal This method is  by Container. It has this general form:
void remove(Component 00))
Here, obj is a reference to the control you want to remove. You can remove all all calling

JavaHelpOnline.com

  • Feel free to send us an inquiry, we will reply back in hours.
 

Verification

Posted on September 17, 2014 in Layout Managers And Menus

Share the Story

About the Author

Back to Top