-It has some system Menus
-We should be able to drag it.
-We should be able to resize it e.t.c
-Some of the best examples of the window application are edit plus editor, notepad, IE browser e.t.c
Note : As console cannot display GUI’s window cannot display text directly.
-In order to display text on the window, we need to represent the text in the form of a GUI component and then add it to the window. For this, we make use of the label class.
-We always prefer to create a window through frame because window alone has no feature of boundaries. The facility of having boundaries for a window is possible with frame. This is the reason why we create window through frame.
-Using the functions of the frame class we can set the dimensions (size) for the window.
Ex: f.setsize ( 4000, 400 );
Note : Bye default, window would always, be created in the invisible mode. To make the window visible on the VDU, we should explicitly set the visibility property of the window to the Boolean values ‘true’.
Ex: f.set visible ( true );
-A constructor defined in the frame class takes a string class object as an argument. Thus, whatever the text we want to see in the title bar of the window, we neeed to pass it as an argument ( in the form of a string class object ) to the constructor of the frame class.
Let us develop a simple program which displays a GUI as shown aside.
Hint : This GUI consists of six components. Two labels +two text fields + one button + one frame (window).
Code: Import java.awt.*;
Class form1 form1.java
{
Public static void main (String args [ ] )
{
Frame f1 = new frame (“login page”);
Label l1 = new lable (“ user name” );
Label l2 = new label ( “password” );
Text field tf1 = new test field ( );
Text field tf2 = new text field ( );
Button b1 = new Button ( “submit” );
f1.add(l1);
f1.add(l2);
f1.add(tf1);
f1.add(tf2);
f1.add(b1);
f1.set size (437, 437);
f1.set visible (true);
}
} -When we execute the above program, we can see only the button on the window, this is because, all the components have been added but one upon another. The last component added is the button and hence we see only the button.
-This resulted because we have not mentioned, to which part of the window, the components have to be added. Hence they have occupied the entire window.
-So, to make all the components visible we have to align them properly on the window.
-We have some standard procedures using which we can align the components in the frame ( container ).
-The standard procedures which exactly specify the way in which we align the components on the container are known as layout managers.
-We have five layout managers in the awt package. Where each layout manager in the name of a class.
i) border layout
ii) Flow layout
what is the use of new keyword in awt programming
AWT
AWT (Abstract Window Toolkit) is a top-level Java package. Listing out the hundreds or thousands of methods would be a waste of effort. See the related link below for the Java documentation on the AWT package.
AWT is a Java package for creating graphical user interfaces. JavaScript is a completely unrelated programming language.
AWT stands for Abstract window tootlkit . Abstract window Toolkit provides a standard application programming interface for writing graphical user interfaces in java.
AWT (Abstract Window Toolkit) is Java's original widget program allowing webmasters to add outside widgets to their sites for users to interface between them and other sites.
AWT stands for Abstract window toolkit. AWT gives us the components using which we can create User- Interface based applications in java. Some of the components are: a. Frame b. Panel c. Window d. CheckBox e. RadioButton f. Button g. TextBox h. TextArea i. Etc
It means you create a derived class.
A Winters Tale
awt contains all the graphical features of java, including many different elements to create an acceptable and usable GUI for applications easily. such as buttons, sliders and text areas.
The AWTEventListener interface implements the EventListener interface.
AWT stands for Abstract Window Toolkit It contains the list of java classes & packages that can be used to create UI based applications using java. Some components available are: * button * text field * text area * scroll bar * etc...