AWT
AWT Stands for Abstract Window Toolkit.
It is an API.
It is used to create graphical user interface/ tools.
How to include library for using awt-
import java.awt.*;
* includes all functions and utilities under awt library.
Inherites the Frame to your driver class/ main class-
class first extends Frame
{
// Name of class is first
}
Use of constructor- (inside the driver class)
class first extends Frame
{
first()
{
}
}
Creating Frame -
We need to create Frame inorder to create tools.
Firstly, Frame is created inside it we create tools.
class first extends Frame
{
first()
{
setSize(400,400);
setLayout(null);
setVisible(true);
}
}
Here creates 3 functions inside the constructor -
1.setSize(height,width);
2.setLayout(null);
3.setVisible(true);
Call the Constructor- (in the main method)
class first extends Frame
{
first()
{
setSize(400,400);
setLayout(null);
setVisible(true);
}
public static void main(String args[])
{
first F1= new first();
//Here the constructor will be implicitly called.
}
}
Comments
Post a Comment