GUI APPLICATIONS_PART 1
The graphical user interface(GUI) of an application can include a variety of components such as buttons ,checkbox,text fields etc A user can interact with a GUI application though these components .java provides abstract window toolkit (AWT) package which enable the programmer the GUI applications .These package come with built in classes,interfaces and methods to implements windows_based functions
- Component :Component class is a abstract class of all the classes of GUI elements . this responsible for effectively rendering the components moniter handling various events like mouse keyword events in the GUI applications
- Container: Container class contains an AWT components for managing the layout and placing the AWT components within it .
- Window: Window object recognized a top_level window with no border and menu bar .it is used to define the layout of the window .The window created directly but derived from its subclasses called Frame
- Panel: Panel is another type of Container object which is base class of applet A panel represents a Window space on which the GUI components are display.
- Frame: the Frame object recognize window space with a border and menu bar .it supports all the window events like open,close,activate, and deactivate.
Most important methods of Frame:
- Window hide and show: After a frame Window has been created ,it will not be visible.it can be visible only called setVisible() method
- Windows title: The title of the window has been changed by using setTitle() method.
- windows background: windows background has been set by using setBackground() method
How we can create a Frame:
we ca create a Frame by two wys.
1.Create by object of Frame class.
2.By extends Frame class
1.create by object of Frame class.
import java.awt.*;
class MyFrame
{
public static void main(String[] args)
{
Frame f=new Frame(); // invisible mode
f.setVisible(true);
f.setSize(200,200);
f.setBackground(Color.YELLOW);
}
output:
}