Creating a frame in AWT is simple and it can be done in many ways. Yet the most preferred and the most easiest way is here.
AWTFrame() : The default constructor of the class AWTFrame
new AWTFrame() : Creating the object for the AWTFrame class
import java.awt.*;import java.awt.* : Import everything from java.awt package excluding its sub packages
class AWTFrame extends Frame
{
public AWTFrame()
{
setTitle("AWT Frame"); // Set the title
setSize(400,400); // Set size to the frame
setVisible(true); // Make the frame visible
setBackground(Color.red); // Set the background
setExtendedState(MAXIMIZED_BOTH); // Make the frame maximized
setCursor(Cursor.HAND_CURSOR); // Deprecated
}
public static void main(String args[])
{
new AWTFrame();
}
}
AWTFrame() : The default constructor of the class AWTFrame
new AWTFrame() : Creating the object for the AWTFrame class