0% found this document useful (0 votes)
5 views5 pages

Introduction to AWT in Java

Its about AWT in java
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views5 pages

Introduction to AWT in Java

Its about AWT in java
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

AWT INTRODUCTION

There are two ways of giving inputting to java program


1. CommandUser Interface(CUI) Inputting: If any user interact with java program by
passing same commands through command prompt is known as CUI inputting
2. Graphical user interface(GUI)Inputting: if any user interact with java program through
a graphical window known as GUI inputting.
Graphical user interface
Graphical user interface(GUI) Offers user interaction through some graphical components.
Some of the graphical Components are Buttons ,TextField ,Radio buttons, List
box ,ScrollBar etc
Abstract Window ToolKit(AWT)Controls
Java AWT (Abstract Window Toolkit) is an API to develop GUI or window-based
applications in [Link] these classes are defined in [Link] [Link] [Link]
package provides classes for AWT api such as TextField,Button,Label,TextArea
,RadioButton,CheckBox,Choice,List etc.
Awt components are platform dependent and heavyweightt:
Awt components are platform dependent because program written in awt behaves
differently in different operating systems and awt components are displayed with different
sizes in different operating systems. AWT components are considered heavy
weight because they are being generated by underlying operating system (OS). For example
if you are create a button in AWT that means you are actually asking OS to create a text
box
JAVA AWT HIERARCHY
Component class in java
• Component is an object having a graphical representation that
can be displayed on the screen and that can interact with the
user. For examples buttons, checkboxes, list and scrollbars of a
graphical user interface.
Useful Methods of Component class
1. public void add(Component c)
inserts a component on this component.
2. public void setSize(int width,int height)
sets the size (width and height) of the component.
[Link] void setLayout(LayoutManager m)
defines the layout manager for the component.
[Link] void setVisible(boolean status)
changes the visibility of the component, by default false.
Explain the AWT Container hierarchy and explain them?
Container Class in java

Container:
The class Container is the super class for the containers of AWT. Container object can contain other
AWT components. The Container is a component in AWT that can contain another component
like buttons, textfields, labels etc. The classes that extends Container class are such as
Window,Panel and Frame
Window
The window is the container that has no borders and menu [Link] is extended by Frame,Dialog
Panel
The Panel is the container that doesn't contain title bar and menu bars. It can have other components
like button, textfield [Link] is extended by Applet
Frame
The Frame is the container that contain title bar and can have menu bars. It can have other
components like button, textfield etc.
import [Link].*; [Link](300,300);
public class Menuex extends Frame
{ [Link]([Link]);
Frame f; [Link](null);
Panel p; [Link](true);
Label l; [Link](l);
public Menuex() [Link](p);
{ }
f=new Frame(); public static void main(String
p=new Panel(); args[])
l=new Label("user name"); {
Menuex m=new
[Link](200,200,100,20); Menuex();
[Link](500,500); }
}
[Link](true);
[Link](null);

You might also like