Abstract Window Toolkit Overview
The Java 1.1 JDK ( Java Developer's Kit) occurred in December 1996. This release includes many improvements and additions to AWT and is a major step for- ward
Untitled
JAVA provides a rich set of libraries to create Graphical User Interface (GUI) objects in an platform independent way. Abstract Window Toolkit (AWT) is a
Introduction to Abstract Window Toolkit:(AWT)
class in java.lang package. ? AWT is used to build the graphical user interface with standard windowing elements.
AWT AWT stands for Abstract Window Toolkit. It is a platform
It is a platform dependent API for creating Graphical User Interface (GUI) for java programs. Why AWT is platform dependent? Java AWT calls native platform (
Difference Between AWT and Swing Key Difference - AWT vs Swing
05-Feb-2018 difference between AWT and Swing is that AWT is Java's original platform dependent windowing graphics
Introducing AWT
•The Abstract Window Toolkit (AWT) was Java's first. GUI framework. Component An abstract superclass for various AWT components. Container.
GUI Programming
Java and GUIs. • There are two primary built-?in packages that provide. GUI components in Java. – java.awt.*. – java.swing.*. • The Abstract Window Toolkit
The AWT Applets
https://users.cs.fiu.edu/~weiss/cop4338_spr02/lectures/AWT/awt.pdf
working with frames graphics
font. AWT Control
Introduction to GUIs (Graphical User Interfaces) Interactive Programs
How does Java do GUIs? 4. Java Support for Building GUIs. • Java Foundation Classes. ? Classes for building GUIs. ? Major components. ? awt and swing.
UNIT-2
Introduction to
Abstract Window
Toolkit:(AWT)
INDEX2.1WorkingwithWindowsandAWT:
AWTclasseshierarchy
WindowsFundamentals
2.2Workingwithframewindows:
creatingaframewindowinapplet,Canvas,
Creatingwindowedprogram
2.3Workingwithgraphics²
AWTControls:Labels,TextField,Pushbuttons
2.4LayoutManagers:
FlowLayout,
BorderLayout,
GridLayout,
CardLayout)
2.5GUIwithSwingusing:
JRadioButton,JComboBox,Menus
2.6EventClasses:
MouseEventClass,
ActionEventClass,
WindowEventClass
2.7EventListnerInterface:
MouseListener,
ActionListener,
WindowListener
KeyListner
AWT CLASSES
|AWTmeansAbstractWindowToolkit. |AWTisanobject-orientedGUIframework. independentinterfaceforapplications. |AWTisoneofthelargestpackages. developGUIapplicationsandapplets. |AWTcontainsclassesthatcanbeextendedand theirpropertiescanbeinherited,andalsobe abstract. classinjava.langpackage. withstandardwindowingelements. |GUI=GraphicalUserInterfaceApplet
windowComponent
MenuComponent
Objcet
Checkbox
Button
PanelCanvas
TextComponent
DialogContainer
Scrollbar
Choice
ListJava.lang
FrameFileDialog
TextArea
TextField
MenuBar
MenuItem
MenuCheckboxMenuItem
WINDOWSFUNDAMENTAL
bordersormenubar. windowobject. |DefaultLayoutforwindowisBorderLayout. orappletareayouareworkingon. windowmanagermightprovide. title) windowthathasaframewindowasitsparent. windowapplication. usedbyitsFrameandDialogsubclasses. |Constructor: publicWindow(Frameparent)Whenparentisminimized,Windowisalso
Window.
Forappletyoucanpassnullparameter(because
createDialog. |Windowclassappearancemethod: thecomponentistcontains. methodgeneratesWindowEventwithIdWINDOW_OPENED.
methodgeneratesWindowEventwithIdWINDOW_CLOSED.
ofthedisplay.5.public void toBack() : puts the window in back
ground of the display.6.public void boolean isShowing() : returns true
if the window is visible on the screen.Window class events:
WINDOW_DESTROY,
WINDOW_EXPOSE,
WINDOW_ICONIFY,
WINDOW_DEICONIFY,
WINDOW_MOVED
CONTAINERCLASS
them. capabilitytocontainothercomponents. eventstoitscomponents. withlayouts. withinacontainer. organizedbyLayoutManager.Container
WindowPanel
|Therearetwobasictypesofcontainer: seperatefromthemainprogram.Ithastwosubclasses
2)Panelclass:
window. panelclass. smalllersections.PANELCLASS
containerwithnospecialfeatures. objects. ofthePanelclass. inawindow. rightandtoptobottom. Panel p=new Panel( );CCŃUHMPHV 3MQHO ŃOMVV·V RNÓHŃPIMNHO O QHR IMNHO´RNµ
p.add( l );//add control to panel object add(p);//add panel object to containerCANVASCLASS
drawing.Graphicsobjectprovidedbythecanvas.
|Itprovidessingleparameterconstructorand paint()method.Canvasc=newCanvas();
c.resize(50,50); c.setBackground(Color.red); add(c);FRAMECLASS
application.Itmayalsoincludemenubar. specifytheicon,cursor,Menubar,andtitle.MenuBarobject.
|DefaultlayoutisBorderLayout. applications. iconimagehavemenus. otherhighlevelprogramsinyourwindowing environment. object. |Frame class defins 14 constants that are used to specify different types of cursors to be used with in the frame. public final static int DEFAULT_CURSOR public final static int CROSSHAIR_CURSOR public final static int TEXT_CURSOR public final static int WAIT_CURSOR public final static int SW_RESIZE_CURSOR public final static int SE_RESIZE_CURSOR public final static int NW_RESIZE_CURSOR public final static int NE_RESIZE_CURSOR public final static int N_RESIZE_CURSOR public final static int S_RESIZE_CURSOR public final static int E_RESIZE_CURSOR public final static int W_RESIZE_CURSOR public final static int HAND_CURSOR public final static int MOVE_CURSORDIALOGCLASS
implementdialogboxwindows. |Borderlayoutisadefaultlayout. beforeresponding. setthedialogNR[·Vresizableproperties. |Dialogclassprovidesaspecialwindowthatis normallyusedforpopupmessagesorinputfrom theuser. |ItshouldbeassociatedwithFramethatmaybe modelessormodaldialog. andthedialog. boxisopened. |Constructor:1.public Dialog(Frameparent)
2.public Dialog(Frame parent, String title)
3.public Dialog(Frame parent ,String title, boolean
modal) |Methods:1.public String getTitle():
2.public String setTitle(String title):
3.public boolean isResizable():
4.public boolean setResizable(boolean resizable):
5.public boolean isModal():
6.public void setModal():
AWT CONTROLS
|Label |TextFields |TextAreas |Buttons |Checkboxes |CheckboxGroup |ChoiceList |Scrolling lists |Scrollbars |Menus LABEL containerwhichcantbeeditedbyuser. componentsinthecontainer.Labell1=newLabel´QMPHµ;
add(l1); |Labelconstructor: givenalignmentvalue.0isLabel.LEFT,
1isLabel.RIGHT,
2isLabel.CENTER
Methods:
1.getText()
2.setText(String)
3.GetAlignment()
4.SetAlignment(int)
TEXTFIELDS
ofcolumns.TextFieldt1=newTextField(8);
add(t); |TextFieldsConstuctors: wide. argumentdefinesno.Ofcharacterstodisplay. givenstring. numberofcharacterswide. |Methods1.getText()
2.setText (String)
3.getColumns()
4.select(int,int)
5.selectAll()
6.isEditale()
7.setEditable(boolea
n)8.getEchoChar()
|Description |Returnstextcontainedintextfield |Putsthetextintextfields |Returnswidthofthistextfield |Selectstextbetweentwointeger positions |Selectsalltextinthefield |Returnstrueorfalsebasedon whethertextiseditable. |Trueenablestexttobeedited,false freezesthetext |Returnscharacterusedformaking input.TEXTAREA(EXAPMLE)
ofrowsandcolumns. |Thenumberofrowsandcolunsarespecifiedas parameterstotheconstructor editmode.TextAreat=newTextArea(5,20);
Add(t);
|TextAreaconstructor: and0characterswide. givennumberofrowsandcolumns3.TextArea (String):creates a text area displaying the
given string.4.TextArea(String,int,int):creates a text area displaying
the given string and with given dimensions7H[P$UHM P QHR 7H[P$UHM´OL \Q OHOORµ72D
Methods:
1.getColumns()
2.getRows()
3.insertText(String,int):inserts the string at the given
position in the text4.replaceText(String,int,int):replaces the text between
the given integer positions with the new stringBUTTONS
presentable. |Buttonconstructor:1.Button()
2.Button(String)
Wecanaddbuttoninpanelusingfollowingcode:
Panelp=newPanel();
Buttonb=new%XPPRQ´RNµ;
p.add(b); |Methods yString getLabel() : read label from button yvoid setLabel( String s) :set Label on button component.StringgetActionCommand()
//returnvalueisactioncommand. thatmustbeimplementedbyactionlistener. voidactionPerformed(ActionEventae) |Steps to use button in applet:1.Create a Button object.
2.Register the applet to receive action events generated by
the button.3.Invoke the add( ) method to add the Button object to
applet.4.Implement the ActionListener interface in applet.
CHECKBOXES
page. control checkboxeswhethercheckedorunchecked.Syntax:
Checkboxch1=newCheckbox("pen");
add(ch1);Methods:
getLabel()setLabel(String)getItem( ) getState()setState(boolean)getItemSelectable( ) getstateChange( )Constructor :
|Checkbox ( ) |Checkbox(String s,boolean state) |Checkbox(String s,boolean state,CheckboxGroup grp) |Checkbox(String s, CheckboxGroup grp,boolean state)Another methods
|void addItemListener(ItemListener il) |void removeItemListener(ItemListener il)CHECKBOXGROUP(RADIOBUTTONS)
toimplementradiobuttons. intime. |WecangetandsetCheckboxGroupobject.CheckboxGroupcbg=newCheckboxGroup();
Checkboxch1=newCheckbox("male");
ch1.setCheckboxGroup(cbg); ch1.setState(false); add(ch1); |Checkbox getSelectedCheckbox( ) |void setSelectedCheckbox (Checkbox cb)CHOICELIST
|Choice class is used to implement pull-down lists that can be placed in the main area of a window. |This list are known as option menus or a pop-up menu of choices. |It is a pop up list of strings from which a single string can be selected. It enables selection of one Item at a time.Choice c=new Choice();
ŃBMGGHPHP´NOXÓµ
FDGG,WHPquotesdbs_dbs17.pdfusesText_23
[PDF] abstraction in oop definition
[PDF] abstraction in oop java
[PDF] abstraction in oop python
[PDF] abstraction in oops with example
[PDF] abstraction in oops with example in java
[PDF] ac 120/230 v (50/60 hz) to watts
[PDF] ac 60hz to 50hz converter
[PDF] ac capacity calculation
[PDF] ac circuits problems and solutions pdf
[PDF] ac current
[PDF] ac frequency us
[PDF] ac tonnage calculation formula
[PDF] ac unit calculator
[PDF] ac2o dmap mechanism