Anúncio
UNIT 5- AWT AND SWING.pdf
UNIT 5- AWT AND SWING.pdf
UNIT 5- AWT AND SWING.pdf
UNIT 5- AWT AND SWING.pdf
Anúncio
UNIT 5- AWT AND SWING.pdf
UNIT 5- AWT AND SWING.pdf
UNIT 5- AWT AND SWING.pdf
UNIT 5- AWT AND SWING.pdf
UNIT 5- AWT AND SWING.pdf
Anúncio
UNIT 5- AWT AND SWING.pdf
UNIT 5- AWT AND SWING.pdf
UNIT 5- AWT AND SWING.pdf
UNIT 5- AWT AND SWING.pdf
Próximos SlideShares
UNIT 1- INTRODUCTION TO JAVA.pdfUNIT 1- INTRODUCTION TO JAVA.pdf
Carregando em ... 3
1 de 13
Anúncio

Mais conteúdo relacionado

Destaque(20)

Anúncio

UNIT 5- AWT AND SWING.pdf

  1. Page: VDate: lT Evemt Hamdlimq Event: Chamqe in status of am abfec Press a buttom,draq & adrop of moue EVemt Hamdinq (ompoments Evenmts An ewCmt 1s a chanqe in Stufe or m Ob/ect Evemt Sorre Ls m_object fhat qemorates m ewemt Cistemers An object fhat istoms to am evmt A Dstemer. qet motiied when G) evemt Occcrs How are eents hmdled ? O A sends it with the Sounte to me ov more /iste es SOrT Cveny Omre lisfem rere/ves the Nent, the eNomt cwill be processed efrDed o. 7w0 tupeS 01 CYOnts O Low /0vel evonts Repreromt direcf commmicatio pom User e key_presse Telease Fo1owmy re lowjeve! ewemh: 0 CmmpdnentEvemt. FocusE VOm F keyE vemt CodtainerEvemt ) WindowEvemt
  2. Page Date: Righ 1velevoms: (o Sematc evon E iCap5u/ates meminq of a_uSer In1ertuce compovemt foliowinq ne hiqh lerel' eWmt OActiomElomd Adjustm etEvemt (scaol)brr ZfomE VCNnt ItemE vem t TentEv emt Evemt ist e 07 Evemt Evemt method Sore
  3. TTO Page Date 1mporf jwca, Swimq.* impert /mpo7 (Owa. Gcut. evemt| owa, a wt. Class myevemt extemds JFrm2e J/mp/ememts Achnmtiifem e mYeN Cmt ) WAAKTRbaReaU DRuttor(iaCLALON, TeaiFiet cd 1:neuw Jleatfietd (is) 5ellay0uf(new Flowlayout c)) ddl(b) abebeiady JButfom 90w JButtm ("clic/e "); b.adelActicm listomer (this) add (b);_ SefSie 200,2o0) Sef Vib/e (_frue) Setpetqult ClosedperaiOm JFoame EX TT_ONLa public e void ActIonPetormed(AchenFvew tsetTeat(" Heluo") P.s vmShimq oqs) myevt m 2ew_myevetC)
  4. Page Date: aivodeupened class MWind exkord inm Label A1 Mhlind O seldayeAut add add Windeuli his) public NO1d uindou Opened(ndnuend ttseTet winoudoftnad
  5. Page V Date Windouwtisten r Clas public class windowerample eatemdJs JFrome implemens Windowlistem er o b j e e t u A t be 2 0 q s t o r c 4 abtornpsneAt. WimdowLIMp/ e ) dddwimdowListemer (this) SetSie 400,400o Setlayout ( mul) SetVishb/e (frue) ps.v.m Stvinq t) oqs windowexamp ie w new window exmple) pubiicvoid windowAciuted (WmdouwEveB e ) S.op." achivafed "); pubiic vord wmdowClosog(WindowEvemt e S.0.p. (" closimq") public voic wmdowDeach vated ( Wim dowEvent e) S 0 p.(" Deact vated");
  6. Page Date: Java Adopter Classes Provides deroult implem emtutioon of isteme intortares Lf we /nhomit the adap1or class we will not be force d topovioe /272p/ememtuh m ut au methods or istene 1ntvrtuces. So t Saves ode. Owa. awt.ew Omt/tdapter ListomeTIntertace Wimdo wBdo listem er WImdowPoapt py KeyListemex MtaselUTtene MouseMoionLisfemoY A.dapter Class Keyfdapter Focuststemor Lompom entlistener CntwnertistenY Hieaarhy3oumdslitener public Class CwindowCXOmp/e extermds Thepe Windorwhdapfer windouGKONp/e () JFrme new RPe () 1.addwIn dowlistener e Nirdaurdopdto4) sefize (300,300)ISeflayoui (mulu) sef Visible ( frue) p.s,V, m ( Shinq I qs) CUmdOwOCmpiew New wIndocvCXqYple0
  7. Page V Date: public vojd wimdowClosinq(WindowEVon e) S.op ( windocw_clored"). dvantug es Reuseability of classes Makes císes more visibe Omretated closses cm wOr toerher Snme class cm be usedim my Cwaus
  8. Page: T Date:I| /17ONYmoUs InnerClass 17mCwa ZmeC/ass without mome Cmly Simqle. object iÍ oeoted J Defn: A claSs thaf hos No manme kmowr as cm momymous /nmer class Used you howe to 0ove7dp a method of tlass /7tetare Cm be ceatecd 1 tw0 waysS O ClasS ( abstoa ct r comTe1e InteÍo Ce_ abstra ct class_pOIOn abstadct yoid eat.() class est P.Sym 51nmqtj_aqS)_ Peoscm N etw peISON t) V0id eat () OvCrTide .0p Nire"): p eat )__
  9. Page: Date: L inter tace /nictu ce_eatable void eat c) Class fest eatuble e mew eatoble()_ override pubiic yoic eat C) S.op(Nice" e.eatt
  10. Page Date: Jmemy Relat ecd classe JmemBar, TMemu JMenulfem pant of swimq packaqe JMemuBar ttaimsJMemu dbjects J Memu 0b/ect awhem seiectecidiplca DOpop Showimq Cme c more JMemdTfe are COms1auctor Tmemu Bar ( Tmen ) Tm emu Stvmg mame Methods add Tmemu C)_ add ( Compmemt c) dd Compomemt n t imdea add d Stzin S)-Oppend JMenaBar mb: mew J17or7UKr() Imemut: ew TMemu ("_File");_ e 22ew TMenu ("Edit") Jmenultem o : mecw 7Memwl1em["pon .add o)_
  11. Page Date: TFile ChooseN Swinq). CJsed to selec a hl, folder by arer Constouctoa Jfie ChoosCr () -User odefault dizectoay TF7e Chooser(SIrinq) - qivn path ThieCh00s File P)-q/te fe as poh Method I show0penDialoq() getSelectecl Frle ) e1Ab solutePath ) TCol-Chods er Used to Create a color chooser dialoq bo so that Us er com serect om COtbr. Constructor (O) Jolorhooser C) ' Osed. to crcate a Color cChoosCr pOmej Cvifh white co/0 /nitially TColor Choosor color initialco lor) OIsed to cyeate a colo choose pmej CWIth Specifred coro initally . Methods O vord addchooserPamet (Absbartlolorhoasfar Pmei) Us ed to add a colochoose prmetto the color hooso O stat1C (olo shocw DIalo q ( Compooomt c Stormq tifie'Color mialCo10r) CsedU to show color choasco dialoq bo
  12. Page Date DialoqS Messaqe, Contirmatom)1rp)F TAle Ghooser, JCOlorChoose Dialoq windocw is am /ndepemdem Sabcuim do w to show femPorrY Noe apart hom maun Swlng Most dialoqs poesont C eot _ Cuorn ihq 7o User bu dialo94 C po esomt mbqes, dioectory tres TO Ceate mple dialoqs you Cn ImP appn cwindea USe OptionPome class TWO Othor closses TToloochooser P JHethoaser Supply Stom dad dialoqs Dialo q b0 C M1ode aialog bon (3 modeless didloq box
Anúncio