A DISSERTATION SUBMITTED AS PARTIAL PARTIAL FULFILLMENT OF THE REQUIREMENT OF THE SUBJECT INFORMATICS PRACTICES OF CLASS XI I OF CENTRAL BOARD OFSECONDARY EDUCATI ON S ES S I ON 2 01 5–1 6
Submitted by
Rishab Thakur (REG. NO. : )
Under the Supervision of SUNITA DEKA Computer Teacher, Opp. To ram Mandir, Basistha Road, Guwahati – 7! "#$, %ssam.
Delhi Public School, Guwahati Ahomgaon, Guwahati, Assam – 781 !". !".
Delhi Public School, Guwahati
Phone:(0361)2
Ahomgaon,Guwahati – 781 029, Assam.
Date:………….…
Ceti!icate
This is to certify that Rishab Thakur student of C&ass – '(( of CBS) CBS) , successfully carried out the proect !or" entitled " Hotel Management System” at Delhi Pu#lic $chool, %u!ahati, &ho'aon, %u!ahati, &ssa' 2* for the session 201+16, under 'y uidance. This proect report has #een prepared as a partial fulfill'ent of the su#ect Informatis !raties of "lass # $II under "entral %oar& of Seon&ary E&uation the session 200- under "entral 0*.
Sunita De#a Computer Teacher, %hom*aon, Guwahati – 7! "#$, %ssam.
Delhi Public School, Guwahati
Phone :(0361)2
Ahomgaon, Guwahati – 781 029, Assam.
Date:………….…
Ceti!icate
This is to certify that Rishab'Reg( No() a student of C&ass – '(( of CBS) CBS) , successfully carried out the proect !or" entitled " Hotel Management System” at Delhi Pu#lic $chool, &ho'aon, %u!ahati, &ssa' 2* for the session 201+16, under 'y uidance. This proect report has #een prepared as a partial fulfill'ent of the su#ect Informatis !raties of "lass # $II under "entral %oar& of Seon&ary E&uation the session 200- under "entral 0*.
$%s. Chan&ale#ha 'awat( +rincipa&, e&hi +u-&ic Schoo&, Guwahati, %hom*aon, Guwahati – 7! "#$, %ssam.
A#$NO%&E'GEENT A#$NO%&E'GEENT
a' /ery 'uch rateful to Delhi !ubli Shool* +u,ahati for for i/in us the chance to carry out our lass proect !or" at its pre'ises (&ho'aon, %u!ahati, &ssa' -1 02*) for the session 201+16.
!ould li"e to epress 'y deepest sense of ratitude to Sunita
De#a *
o'puter Teacher, Delhi Pu#lic $chool, %u!ahati for her constant inspiration, /alua#le suestions and construction criticis' at e/ery stae of the present !or".
$'ishab(
C&ass – '((, (nfo. Sc. %hom*aon,Guwahati – 7! "#$, %ssam.
CONTENTS
Chapt er s
PageNo.
1.I nt r oduct i ons 1. 1 I nt r oduct i ont oRDBMS 1. 2 I nt r oduc t i ont oNe t BeansI DE6. 7. 1 2.Ove rv i ew oft heSys t em 3.Obj ect i veoft hePr oposedSyst em 4. .T To ol s/Env i r onme ntus ed 5. .S Sys t em Anal ys i s 6.S .Sys t em Desi gn 6. 1Desc r i pt i onoft heSys t em Modul es 6. 2De s c r i pt i o no ft heTabl e /Re l at i o n 6. 3Dat aDi ct i onary 7. .R Repor t 7. 1I nputFor m
)))
*+'-DC*-+S 1.1 *nto&uction to 'D/%S 4D5$ stands for 4elational Data#ase anae'ent $yste'. 4D5$ data is structured in data#ase ta#les, fields and records. 7ach 4D5$ ta#le consists of data#ase ta#le ro!s. 7ach data#ase ta#le ro! consists of one or 'ore data#ase ta#le fields. 4D5$ store the data into collection of ta#les, !hich 'iht #e related #y co''on fields (data#ase ta#le colu'ns). 4D5$ also pro/ide relational operators to 'anipulate the data stored into the data#ase ta#les. ost 4D5$ use $89 as data#ase uery lanuae. 7dar odd introduced the relational data#ase 'odel. any 'odern D5$ do not confor' to the odd;s definition of a 4D5$, #ut nonetheless they are still considered to #e 4D5$. The 'ost popular 4D5$ are $ $89 $er/er, D52,
1.2 *nto&uction to +et/eans *D .7.1 The =et5ea =et5eans ns D7 is an a!ard! a!ard!inn innin in inter interate ated d de/elop de/elop'en 'entt en/iron' en/iron'ent ent a/aila#le for >indo!s, ac, 9inu, and $olaris. The =et5eans proect consists of an opensource D7 and D7 and an application platfor' that platfor' that ena#le de/elopers to rapidly create !e#, enterprise, des"top, and 'o#ile applications usin the ?a/a platfor', as !ell as ?a/a@, PAP, ?a/a$cript and &a, 4u#y and 4u#y on 4ails, %roo/y and %rails, and BCC. The =et5eans =et5eans proect proect is suppor supported ted #y a /i#ran /i#rantt de/elo de/eloper per co'' co''unity unity and offers etensi/e docu'entation and trainin resources trainin resources as !ell as a di/erse selection of third party pluins party pluins.. =et5eans D7 6. is interated !ith Proect enai, enai, a colla#orati/e en/iron'ent for de/elopers to host opensource proects. >ith enai and the =et5eans D7, a tea' of de/elopers is a#le to create proects, chec" out, edit, de#u, #uild, discuss, and co''it code, all throuh one easytouse interfaceE The release also #uilds on the success of =et5eans 6.+ !ith nati/e support for a/enF %lass@ish, issue trac"er and Audson interationsF and enhance'ents to ?a/a, PAP, 4u#y, %roo/y and BCC. Aihlihts of the 6. release include support for ?a/a$cript 1., 4u#y 4e'ote De#uin, and interation of the ?a/a 7 $D 3.0.
GGG
-3'3*4 -5 6 SS% Aotel anae'ent anae'ent $yste' $yste' 4oo's are the entities entities of real !orld syste' that contains contains fields and its respecti/e /alues in it. ollections of these related infor'ation 'a"es a data#ase. &n interface is selected to interact !ith the user and store the infor'ation passed #y the'. >hen an interface is eecuted, the entities interact #y sendin 'essaes to one another. $o, in this syste' fe! procedures are prepared to accept the /alues into the attri#utes, 'anipulate the entities to 'aintain the infor'ation in respecti/e ta#les and to prepare a report on the'.
GGGGGGGGGGGGGGGGGGGGG
-/C*3 -5 6 P'-P-SD SS% The o#ecti/e of this syste' is to i'ple'ent the concept of 4D5$ !ith an nterface "no!n as =et5eans D7 6..1. The concept of fieldsB&ttri#utes, records, ta#les, 7ntitiesB Data#ase, 4D5$, pac"ae, pac"ae interactin !ith ta#les, relation #et!een entities etc is #een used. >e ha/e already #een introduced to spreadsheets, data#ases, !ord !ord proces processor sorss and presen presentat tation ion soft!a soft!are re earli earlier er.. That That fa'ili fa'iliarl arly y is #een #een used used to introduce the idea of ho! the soft!are can #e desined #y 'odelin it as operations per'itted on different entities. entities.
GGGGGGGGGGGGGG
--S:+3*'-+%+ SD
indo! >indo! P or a#o/e
ini'u' reuire'ent 1%5 4&
PH Processor or a#o/e
y $89(4D5$)
=et5eans D7 6..1(nterface or Pac"ae)
GGGGGGGGGGGGGG
SS% A+AS*S A+AS*S $yste' analysis is a set of techniue and raphical tools that allo! the analyst to de/elop a ne! "ind of syste' specification that easily understanda#le to the user. The oal of syste' de/elop'ent is to deli/er syste' in line !ith the user reuire'ent.
The data in this syste' syste' !ere collected collected fro' an oraniIat oraniIation ion throuh throuh inter/ie!s inter/ie!s,, uestionnaires, onsite o#ser/ation, procedure 'anuals, and the li"e, after analysis so'e of the fields !ere selected and used for calculation of profit of the oraniIation.
GGGGGGGGGGGGGGG
SS% DS*G+ 6.1 Desci;tion o! the S
%ain %enu
&ll the other for's can #e opened op ened fro' this for'.
6otel %anagement$nt<( 5om
This 'odule is !here the infor'ation of a ne!ly occupied roo' is entered and infor'ation of occupied roo's is edited.
Seach *nte!ace
This 'odule is used to loo" up the infor'ation of a particular roo'.
Dis;la< *nte!ace
This 'odule displays the infor'ation of all the occupied roo's in the hotel.
GGG 6.2 Desci;tion o! ables:elations 6otel +ame =a'e Phoneno 4oo'no 4oo'type =oofdays =oofadults =oofchildren
Data <;e$Si=e( /archar(30) int /archar(30) /archar(30) int int int
GGG
*n&e> =ot =ull =ot =ull Pri'ary ey =ot =ull =ot =ull =ot =ull =ot =ull
C-D The follo!in is the code for the process :: 6otel %anagement$nt<( 5om
pac"ae effersonF i'port a/a.sl.GF i'port a/a.s!in.?
pu#lic Aotelanae'ent@or'() K inito'ponents()F 'odelL(DefaultTa#leodel)t#hotel.etodel()F sho!1()F disa#le1()F updatepanel.setHisi#le(false)F M /oid
K tryK lass.for=a'e(Nco'.'ysl.d#c.Dri/erN)F con L Dri/eranaer.etonnection(Nd#c:'ysl:BBlocalhost:3306B?7@@74$<=N,NrootN,NN)F st't L con.create$tate'ent()F M catch(7ception e)K ?
!hile(rs.net()) K $trin na'eLrs.et$trin(N=a'eN)F $trin phonenoLrs.et$trin(NPhonenoN)F $trin roo'noLrs.et$trin(N4oo'noN)F $trin roo'typeLrs.et$trin(N4oo'ty roo'typeLrs.et$trin(N4oo'typeN)F peN)F $trin noofdaysLrs.et$trin(N=oofdaysN)F $trin noofadultsLrs.et$trin(N=oofadultsN) noofadultsLrs.et$trin(N=oofadultsN)FF $trin noofchildrenLrs.et$trin(N=oofchildrenN)F
'odel.add4o!(ne! <#ectO Kna'e,phoneno,roo'no,roo'type,noofdays,noofadults,noofchildrenM)F M rs.close()F st't.close()F con.close()F M catch(7ception e)K ?
for(int iL0FiRro!sFiCC) K 'odel.re'o/e4o!(0)F M M M /oid setdata($trin ) K try K
$trin ueryLNselect G fro' hotel !here roo'no LNCCNFNF 4esult$et rsLst't.eecute8uery(uery)F if(rs.net()) K $trin na'eLrs.et$trin(Nna'eN)F $trin phonenoLrs.et$trin(NphonenoN)F $trin roo'noLrs.et$trin(Nroo'noN)F $trin roo'typeLrs.et$trin(N4oo'ty roo'typeLrs.et$trin(N4oo'typeN)F peN)F $trin noofdaysLrs.et$trin(N=oofdaysN)F $trin noofadultsLrs.et$trin(N=oofadultsN) noofadultsLrs.et$trin(N=oofadultsN)FF $trin noofchildrenLrs.et$trin(N=oofchildrenN)F ttna'e.setTet(na'e)F ttphone.setTet(phoneno)F ttroo'no.setTet(roo'no)F ttadultno.setTet(noofadults)F ttchildno.setTet(noofchildren)F
M
M catch(7ception e) K ?
BGG G This 'ethod is called fro' fro' !ithin the constructor to initialiIe the for'. for'. G >&4= >&4==%: =%: Do =arnins(Nunchec"edN) BB Reditorfold defaultstateLNcollapsedN descLN%enerated odeNQ pri/ate /oid inito'ponents() K #utton%roup1 L ne! a/a.s!in.5utton%roup()F puest L ne! a/a.s!in.?Panel()F 9a#el1 L ne! a/a.s!in.?9a#el()F 9a#el2 L ne! a/a.s!in.?9a#el()F
9a#el3 L ne! a/a.s!in.?9a#el()F ttna'e L ne! a/a.s!in.?Tet@ield()F a/a.s!in.?Tet@ield()F ttphone L ne! a/a.s!in.?Tet@ield()F a/a.s!in.?Tet@ield()F 9a#elS L ne! a/a.s!in.?9a#el()F ttroo'no L ne! a/a.s!in.?Tet@ield()F a/a.s!in.?Tet@ield()F prate L ne! a/a.s!in.?Panel()F r#$uite L ne! a/a.s!in.?4adio5utton()F r#$inle L ne! a/a.s!in.?4adio5utton()F r#Delue L ne! a/a.s!in.?4adio5utton()F 9a#el+ L ne! a/a.s!in.?9a#el()F co'#oday L ne! a/a.s!in.?o'#o5o()F 9a#el6 L ne! a/a.s!in.?9a#el()F ttadultno L ne! a/a.s!in.?Tet@ield()F a/a.s!in.?Tet@ield()F 9a#el L ne! a/a.s!in.?9a#el()F 9a#el- L ne! a/a.s!in.?9a#el()F ttchildno L ne! a/a.s!in.?Tet@ield()F a/a.s!in.?Tet@ield()F printpanel L ne! a/a.s!in.?Panel()F #tnPrint L ne! a/a.s!in.?5utton()F #tn7dit L ne! a/a.s!in.?5utton()F #tnDelete L ne! a/a.s!in.?5utton()F #tnhec"out L ne! a/a.s!in.?5utton()F updatepanel L ne! a/a.s!in.?Panel()F #tnpdate L ne! a/a.s!in.?5utton()F #tnancel L ne! a/a.s!in.?5utton()F $crollPane1 L ne! a/a.s!in.?$crollPane()F t#hotel L ne! a/a.s!in.?Ta#le()F a/a.s!in.?Ta#le()F
setDefaultloseindo!onstants.7TU<=U9<$7)F
puest.set5order(a/a.s!in[email protected](a/a.s!in.5order@act puest.set5order(a/a.s!in[email protected] led5order(a/a.s!in.5order@act ory.create9ine5order(ne! ory.create9ine5order(ne! a/a.a!t.olor(0, 0, 0)), N%uest nfor'ationN))F puest.setToolTipTet(NN)F 9a#el2.setTet(N7nter 9a#el2.setTet(N7nter =a'e:N)F 9a#el3.setTet(NPhone 9a#el3.setTet(NPhone =o.:N)F
ttna'e.add&ction9istener(ne! a/a.a!t.e/ent.&ction9istener() K pu#lic /oid actionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K ttna'e&ctionPerfor'ed(e/t)F M M)F 9a#elS.setTet(N4oo' 9a#elS.setTet(N4oo' =o.:N)F
a/a.s!in.%roup9ayout puest9ayout L ne! a/a.s!in.%roup9ayout(puest)F puest.set9ayout(puest9ayout)F puest9ayout.setAoriIontal%roup(
puest9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .add%roup(puest9ayout.create$euential%roup() .addontainer%ap() .add%roup(puest9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97& D=%) .add%roup(puest9ayout.create$euential%roup() .addo'ponent(9a#el2) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D) .addo'ponent(ttna'e)) .add%roup(puest9ayout.create$euential%roup() .addo'ponent(9a#el1) .add%ap(0, 0, $hort.&UH&9 $hort.&UH&97)) 7)) .add%roup(puest9ayout.create$euential%roup() .addo'ponent(9a#el3) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D) .addo'ponent(ttphone)) .add%roup(puest9ayout.create$euential%roup() .addo'ponent(9a#elS) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.=479&T7D) .addo'ponent(ttroo'no))) .addontainer%ap()) )F puest9ayout.setHertical%roup( puest9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .add%roup(puest9ayout.create$euential%roup() .add%ap(20, 20, 20) .addo'ponent(9a#el1) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D) .add%roup(puest9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.5&$ 79=7) .addo'ponent(9a#el2) .addo'ponent(ttna'e, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7)) .add%ap(1-, 1-, 1-) .add%roup(puest9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.5&$ 79=7) .addo'ponent(9a#el3) .addo'ponent(ttphone, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7))
.addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D, 20, $hort.&UH&97) .add%roup(puest9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.5&$ 79=7) .addo'ponent(9a#elS) .addo'ponent(ttroo'no, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7)) .addontainer%ap()) )F
prate.set5order(a/a.s!in[email protected](a/a.s!in.5order@actor prate.set5order(a/a.s!in[email protected] led5order(a/a.s!in.5order@actor y.create9ine5order(ne! y.create9ine5order(ne! a/a.a!t.olor(0, 0, 0)), N4ate nfor'ationN))F
#utton%roup1.add(r#$uite)F r#$uite.setTet(N$uiteN)F
#utton%roup1.add(r#$inle)F r#$inle.setTet(N$inleN)F
#utton%roup1.add(r#Delue)F r#Delue.setTet(NDelueN)F 9a#el+.setTet(N4oo 9a#el +.setTet(N4oo' ' Type:N)F Type:N)F
co'#oday.setodel(ne! co'#oday.setodel(ne! a/a.s!in.Defaulto'#o5oodel(ne! $trinO K N1N, N2N, N3N, NSN, N+N, N6N, NN M))F 9a#el6.setTet(N=o. 9a#el6.setTet(N=o. of days:N)F 9a#el.setTet(N=o. 9a#el.setTet(N=o. of adults:N)F 9a#el-.setTet(N=o. 9a#el-.setTet(N=o. of children:N)F
a/a.s!in.%roup9ayout prate9ayout L ne! a/a.s!in.%roup9ayout(prate)F prate.set9ayout(prate9ayout)F prate9ayout.setAoriIontal%roup(
prate9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .add%roup(prate9ayout.create$euential%roup() .addontainer%ap() .add%roup(prate9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D =%) .addo'ponent(9a#el+) .addo'ponent(r#$inle) .addo'ponent(r#$uite)
.addo'ponent(r#Delue)) .add%ap(S1, S1, S1)
.add%roup(prate9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D =%) .add%roup(prate9ayout.create$euential%roup() .addo'ponent(9a#el-) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D) .addo'ponent(ttchildno, a/a.s!in.%roup9ayout.P47@7447DU$V7, 2*, a/a.s!in.%roup9ayout.P47@7447DU$V7)) .add%roup(prate9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.T4& 9=%, false) .add%roup(prate9ayout.create$euential%roup() .addo'ponent(9a#el) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D) .addo'ponent(ttadultno)) .add%roup(prate9ayout.create$euential%roup() .addo'ponent(9a#el6) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D) .addo'ponent(co'#oday, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7)))) .addontainer%ap(36, $hort.&UH& $hort.&UH&97)) )F prate9ayout.setHertical%roup( prate9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .add%roup(prate9ayout.create$euential%roup() .addontainer%ap() .add%roup(prate9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.5&$7 9=7) .addo'ponent(9a#el+) .addo'ponent(9a#el6) .addo'ponent(co'#oday, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7)) .add%roup(prate9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D =%) .add%roup(prate9ayout.create$euential%roup() .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.=479&T7D)
.addo'ponent(r#$uite)
.addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D) .addo'ponent(r#$inle)) .add%roup(prate9ayout.create$euential%roup() .add%ap(1*, 1*, 1*) .add%roup(prate9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.5&$7 9=7) .addo'ponent(9a#el) .addo'ponent(ttadultno, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7)))) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D) .add%roup(prate9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.5&$7 9=7) .addo'ponent(r#Delue) .addo'ponent(9a#el-) .addo'ponent(ttchildno, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7)) .addontainer%ap(2, $hort.&UH& $hort.&UH&97)) )F printpanel.set5order(a/a.s!in[email protected](ne! a/a.a!t.olor(0, 0, 0)))F
#tnPrint.setTet(NPrintN)F #tnPrint.add&ction9istener(ne! a/a.a!t.e/ent.&ction9istener() K pu#lic /oid actionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K #tnPrint&ctionPerfor'ed(e/t)F M M)F #tn7dit.setTet(N7ditN)F #tn7dit.add&ction9istener(ne! a/a.a!t.e/ent.&ction9istener() K pu#lic /oid actionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K #tn7dit&ctionPerfor'ed(e/t)F M M)F #tnDelete.setTet(NDeleteN)F #tnDelete.add&ction9istener(ne! a/a.a!t.e/ent.&ction9istener() K pu#lic /oid actionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K #tnDelete&ctionPerfor'ed(e/t)F M M)F
#tnhec"out.setTet(Nhec" #tnhec"out.setTet(Nhec"
a/a.s!in.%roup9ayout printpanel9ayout L ne! a/a.s!in.%roup9ayout(printpanel)F printpanel.set9ayout(printpanel9ayout)F printpanel9ayout.setAoriIontal%roup( printpanel9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .add%roup(printpanel9ayout.create$euential%roup() .addontainer%ap() .addo'ponent(#tnPrint) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D) .addo'ponent(#tn7dit) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D) .addo'ponent(#tnDelete) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D) .addo'ponent(#tnhec"out) .addontainer%ap(a/a.s!in.%roup9ayout.D7@&9TU$V7, $hort.&UH&97)) )F printpanel9ayout.setHertical%roup( printpanel9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .add%roup(printpanel9ayout.create$euential%roup() .addontainer%ap() .add%roup(printpanel9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.5 &$79=7) .addo'ponent(#tnPrint) .addo'ponent(#tn7dit) .addo'ponent(#tnDelete) .addo'ponent(#tnhec"out)) .addontainer%ap(a/a.s!in.%roup9ayout.D7@&9TU$V7, $hort.&UH&97)) )F updatepanel.set5order(a/a.s!in[email protected](ne! a/a.a!t.olor(0, 0, 0)))F
#tnpdate.setTet(NpdateN)F #tnpdate.add&ction9istener(ne! a/a.a!t.e/ent.&ction9istener() K pu#lic /oid actionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K #tnpdate&ctionPerfor'ed(e/t)F
M M)F
#tnancel.setTet(NancelN)F #tnancel.add&ction9istener(ne! a/a.a!t.e/ent.&ction9istener() K pu#lic /oid actionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K #tnancel&ctionPerfor'ed(e/t)F M M)F
a/a.s!in.%roup9ayout updatepanel9ayout L ne! a/a.s!in.%roup9ayout(updatepanel)F updatepanel.set9ayout(updatepanel9ayout)F updatepanel9ayout.setAoriIontal%roup( updatepanel9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=% ) .add%roup(updatepanel9ayout.create$euential%roup() .add%ap(1S, 1S, 1S) .addo'ponent(#tnpdate) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D) .addo'ponent(#tnancel) .addontainer%ap(a/a.s!in.%roup9ayout.D7@&9TU$V7, $hort.&UH&97)) )F updatepanel9ayout.setHertical%roup( updatepanel9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=% ) .add%roup(updatepanel9ayout.create$euential%roup() .addontainer%ap() .add%roup(updatepanel9ayout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent .5&$79=7) .addo'ponent(#tnpdate) .addo'ponent(#tnancel)) .addontainer%ap(a/a.s!in.%roup9ayout.D7@&9TU$V7, $hort.&UH&97)) )F t#hotel.setodel(ne! a/a.s!in.ta#le.DefaultT a/a.s!in.ta#le.DefaultTa#leodel( a#leodel( ne! <#ect OO K Knull, null, null, null, null, null, nullM, Knull, null, null, null, null, null, nullM, Knull, null, null, null, null, null, nullM, Knull, null, null, null, null, null, nullM M, ne! $trin O K
N=a'eN, NPhone =o.N, N4oo' =o.N, N4oo' TypeN, TypeN, N=o. of daysN, N=o. of adultsN, N=o. of childrenN M ))F $crollPane1.setHie!portHie!(t#hotel)F a/a.s!in.%roup9ayout layout L ne! a/a.s!in.%roup9ayout(etontentPane())F etontentPane().set9ayout(layout)F layout.setAoriIontal%roup( layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .add%roup(layout.create$euential%roup() .add%roup(layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.T4&9=%) .add%roup(layout.create$euential%roup() .add%ap(2-, 2-, 2-) .addo'ponent(printpanel, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D, 1SS, .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.479&T7D, 1SS , $hort.&UH&97) .addo'ponent(updatepanel, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7)) .add%roup(layout.create$euential%roup() .add%ap(20, 20, 20) .addo'ponent(puest, a/a.s!in.%roup9ayout.D7@& a/a.s!in.%roup9ayout.D7@&9T 9TU$V7, U$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, $hort.&UH&9 $hort.&UH&97) 7) .add%ap(1-, 1-, 1-) .addo'ponent(prate, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7))) .add%ap(3S, 3S, 3S)) .add%roup(layout.create$euential%roup() .addo'ponent($crollPane1) .addontainer%ap()) )F layout.setHertical%roup( layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .add%roup(layout.create$euential%roup() .add%ap(2, 2, 2) .add%roup(layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .addo'ponent(puest, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7)
.addo'ponent(prate, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7)) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.=479&T7D) .add%roup(layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.T4&9=%) .addo'ponent(printpanel, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7) .addo'ponent(updatepanel, a/a.s!in.%roup9ayout.P47@7447DU$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, a/a.s!in.%roup9ayout.P47@7447DU$V7)) .addPreferred%ap(a/a.s!in.9ayout$tyle.o'ponentPlace'ent.=479&T7D) .addo'ponent($crollPane1, a/a.s!in.%roup9ayout.P47@7447DU$V7, -*, a/a.s!in.%roup9ayout.P47@7447DU$V7) .addontainer%ap(21, $hort.&UH& $hort.&UH&97)) )F
pac"()F MBB RBeditorfoldQ
pri/ate /oid #tnPrint&ctionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K updatepanel.setHisi#le(true)F printpanel.setHisi#le(false)F printpanel.setHisi#le(false)F ena#le1()F fla L 1F M pri/ate /oid #tn7dit&ctionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K $trin L ?
K
pri/ate /oid #tnDelete&ctionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K $trin r L ?
G @or details see http:BBdo!nload.oracle.co'Ba/aseBtutorialBuis!inBloo"andfeelBplaf.ht'l GB try K for (a/a.s!in.anaer. (a/a.s!in.anaer.9oo"&nd@eelnfo 9oo"&nd@eelnfo info : a/a.s!in.anaer.etnstalled9oo"&nd@eels()) a/a.s!in.anaer. etnstalled9oo"&nd@eels()) K if (N=i'#usN.euals(info.et=a'e()) (N=i'#usN.euals(info.et=a'e()))) K a/a.s!in.anaer.set9oo"&nd@eel(info.etlass=a'e())F #rea"F M M M catch (lass=ot@ound7ception e) K a/a.util.loin.9oer.et9oer(Aotelanae'ent@or'.class.et=a'e()).lo(a/a.uti a/a.util.loin.9oer.et9oer(Aotelanae'ent@or'.class.et=a'e()).lo(a/a.uti l.loin.9e/el.$7H747, null, e)F M catch (nstantiation7ception e) K a/a.util.loin.9oer.et9oer(Aotelanae'ent@or'.class.et=a'e()).lo(a/a.uti a/a.util.loin.9oer.et9oer(Aotelanae'ent@or'.class.et=a'e()).lo(a/a.uti l.loin.9e/el.$7H747, null, e)F M catch (lleal&ccess7ception e) K a/a.util.loin.9oer.et9oer(Aotelanae'ent@or'.class.et=a'e()).lo(a/a.uti a/a.util.loin.9oer.et9oer(Aotelanae'ent@or'.class.et=a'e()).lo(a/a.uti l.loin.9e/el.$7H747, null, e)F M catch (a/a.s!in.nsupported9oo"&nd@eel7ception e) K a/a.util.loin.9oer.et9oer(Aotelanae'ent@or'.class.et=a'e()).lo(a/a.uti a/a.util.loin.9oer.et9oer(Aotelanae'ent@or'.class.et=a'e()).lo(a/a.uti l.loin.9e/el.$7H747, null, e)F M BBRBeditorfoldQ BG reate and display the for' GB a/a.a!t.7/ent8ueue.in/o"e9ater(ne! 4unna#le() K pu#lic /oid run() K ne! Aotelanae'ent@or'().setH Aotelanae'ent@or'().setHisi#le(tr isi#le(true)F ue)F M M)F M BB Haria#les aria#les declaration do not 'odify pri/ate a/a.s!in.?5utton #tnancelF pri/ate a/a.s!in.?5utton #tnhec"outF pri/ate a/a.s!in.?5utton #tnDeleteF pri/ate a/a.s!in.?5utton #tn7ditF pri/ate a/a.s!in.?5utton #tnPrintF pri/ate a/a.s!in.?5utton #tnpdateF pri/ate a/a.s!in.5utton%roup #utton%roup1F pri/ate a/a.s!in.?o'#o5o co'#odayF pri/ate a/a.s!in.?9a#el 9a#el1F pri/ate a/a.s!in.?9a#el 9a#el2F
pri/ate a/a.s!in.?9a#el 9a#el3F pri/ate a/a.s!in.?9a#el 9a#elSF pri/ate a/a.s!in.?9a#el 9a#el+F pri/ate a/a.s!in.?9a#el 9a#el6F pri/ate a/a.s!in.?9a#el 9a#elF pri/ate a/a.s!in.?9a#el 9a#el-F pri/ate a/a.s!in.?$crollPane $crollPane1F pri/ate a/a.s!in.?Panel puestF pri/ate a/a.s!in.?Panel prateF pri/ate a/a.s!in.?Panel printpanelF pri/ate a/a.s!in.?4adio5utton r#DelueF pri/ate a/a.s!in.?4adio5utton r#$inleF pri/ate a/a.s!in.?4adio5utton r#$uiteF pri/ate a/a.s!in.?Ta#le a/a.s!in.?Ta#le t#hotelF pri/ate a/a.s!in.?Tet@ield a/a.s!in.?Tet@ield ttadultnoF pri/ate a/a.s!in.?Tet@ield a/a.s!in.?Tet@ield ttchildnoF pri/ate a/a.s!in.?Tet@ield a/a.s!in.?Tet@ield ttna'eF pri/ate a/a.s!in.?Tet@ield a/a.s!in.?Tet@ield ttphoneF pri/ate a/a.s!in.?Tet@ield a/a.s!in.?Tet@ield ttroo'noF pri/ate a/a.s!in.?Panel updatepanelF BB 7nd of /aria#les declaration M
Seach *nte!ace pac"ae effersonF i'port a/a.sl.GF i'port a/a.s!in.?
BGG G G Jauthor $tudent GB pu#lic class Aotel$earch etends a/a.s!in.?@ra'e K onnection conF $tate'ent st'tF DefaultTa#leodel DefaultTa#leodel 'odelF BGG G reates ne! for' Aotel$earch GB pu#lic Aotel$earch() K inito'ponents()F 'odelL(DefaultTa#leodel)t#hotel.etodel()F M /oid
$trin ueryLNselect G fro' hotelFNF 4esult$et rsLst't.eecute8uery(uery)F !hile(rs.net()) K $trin na'eLrs.et$trin(N=a'eN)F $trin phonenoLrs.et$trin(NPhonenoN)F $trin roo'noLrs.et$trin(N4oo'noN)F $trin roo'typeLrs.et$trin(N4oo'ty roo'typeLrs.et$trin(N4oo'typeN)F peN)F
$trin noofdaysLrs.et$trin(N=oofdaysN)F $trin noofadultsLrs.et$trin(N=oofadultsN) noofadultsLrs.et$trin(N=oofadultsN)FF $trin noofchildrenLrs.et$trin(N=oofchildrenN)F 'odel.add4o!(ne! <#ectO Kna'e,phoneno,roo'no,roo'type,noofdays,noofadults,noofchildrenM)F M rs.close()F st't.close()F con.close()F M catch(7ception e)K ?&4= >&4==%: =%: Do =arnins(Nunchec"edN) BB Reditorfold defaultstateLNcollapsedN descLN%enerated odeNQ pri/ate /oid inito'ponents() K Panel1 L ne! a/a.s!in.?Panel()F 9a#el2 L ne! a/a.s!in.?9a#el()F 9a#el3 L ne! a/a.s!in.?9a#el()F co'#o1 L ne! a/a.s!in.?o'#o5o()F tt/alue L ne! a/a.s!in.?Tet@ield()F a/a.s!in.?Tet@ield()F #tn$earch L ne! a/a.s!in.?5utton()F $crollPane1 L ne! a/a.s!in.?$crollPane()F t#hotel L ne! a/a.s!in.?Ta#le()F a/a.s!in.?Ta#le()F 9a#elS L ne! a/a.s!in.?9a#el()F 9a#el1 L ne! a/a.s!in.?9a#el()F
setDefaultloseindo!onstants.7TU<=U9<$7)F
Panel1.setursor(ne! a/a.a!t.ursor(a/a.a!t.ursor a/a.a!t.ursor(a/a.a!t.ursor.D7@ .D7@&9 &9TU4$<4))F TU4$<4))F Panel1.set7na#led(false)F
Panel1.setPreferred$iIe(ne! a/a.a!t.Di'ension(+22, 200))F Panel1.set9ayout(null)F 9a#el2.set5ac"round(ne! a/a.a!t.olor(0, 0, 0))F 9a#el2.set@ont(ne! a/a.a!t.@ont(N>ide a/a.a!t.@ont(N>ide 9atinN, 3, 10))F BB =<1-= 9a#el2.setTet(N7nter 9a#el2.setTet(N7nter field na'e:N)F Panel1.add(9a#el2)F 9a#el2.set5ounds(30, 100, 161, 2-)F 9a#el3.set5ac"round(ne! a/a.a!t.olor(0, 0, 0))F 9a#el3.set@ont(ne! a/a.a!t.@ont(N>ide a/a.a!t.@ont(N>ide 9atinN, 3, 10))F BB =<1-= 9a#el3.setTet(N7nter 9a#el3.setTet(N7nter /alue:N)F Panel1.add(9a#el3)F 9a#el3.set5ounds(S0, 1+0, 11+, 20)F
co'#o1.set@ont(ne! a/a.a!t.@ont(NTi'es =e! 4o'anN, 0, 1S))F BB =<1-= co'#o1.setodel(ne! a/a.s!in.Defaulto'#o5oodel(ne! $trinO K N=a'eN, NPhonenoN, N4oo'noN, N4oo'typeN, N=oofdaysN, N=oofadultsN, N=oofchildrenN M))F co'#o1.add&ction9istener(ne! a/a.a!t.e/ent.&ction9istener() K pu#lic /oid actionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K co'#o1&ctionPerfor'ed(e/t)F M M)F Panel1.add(co'#o1)F co'#o1.set5ounds(220, 100, 102, 23)F Panel1.add(tt/alue)F tt/alue.set5ounds(220, 1S0, 330, 30)F
#tn$earch.setTet(N$earchN)F #tn$earch.add&ction9istener(ne! a/a.a!t.e/ent.&ction9istener() K pu#lic /oid actionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K #tn$earch&ctionPerfor'ed(e/t)F M M)F Panel1.add(#tn$earch)F #tn$earch.set5ounds(22+, 1*0, 130, 23)F
t#hotel.setodel(ne! a/a.s!in.ta#le.DefaultT a/a.s!in.ta#le.DefaultTa#leodel( a#leodel( ne! <#ect OO K Knull, null, null, null, null, null, nullM, Knull, null, null, null, null, null, nullM, Knull, null, null, null, null, null, nullM, Knull, null, null, null, null, null, nullM M, ne! $trin O K N=a'eN, NPhone =o.N, N4oo' =o.N, N4oo' TypeN, TypeN, N=o. of daysN, N=o. of adultsN, N=o. of childrenN M
))F $crollPane1.setHie!portHie!(t#hotel)F Panel1.add($crollPane1)F $crollPane1.set5ounds(30, 230, +*0, *1)F 9a#elS.set5ac"round(ne! a/a.a!t.olor(0, 102, 0))F 9a#elS.set@ont(ne! a/a.a!t.@ont(NHi/aldiN, a/a.a!t.@ont(NHi/aldiN, 1, 36))F BB =<1-= 9a#elS.set@oreround(ne! a/a.a!t.olor(0, 102, +1))F 9a#elS.setTet(N$earch 9a#elS.setTet(N$earch nterfaceN)F Panel1.add(9a#elS)F 9a#elS.set5ounds(200, S0, 2+, S+)F
9a#el1.setcon(ne! a/a.s!in.'aecon(N:ZZsersZZ$tudentZZDes"topZZ#ac"roundZZ003!ood'ela'ine a/a.s!in.'aecon(N:ZZsersZZ$t udentZZDes"topZZ#ac"roundZZ003!ood'ela'ine su#ttlepattern#ac"roundpat.pN))F BB =<1-= Panel1.add(9a#el1)F 9a#el1.set5ounds(0, 30, 6S0, S00)F a/a.s!in.%roup9ayout layout L ne! a/a.s!in.%roup9ayout(etontentPane())F etontentPane().set9ayout(layout)F layout.setAoriIontal%roup( layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .addo'ponent(Panel1, a/a.s!in.%roup9ayout.P47@7447DU$V7, 6S0, a/a.s!in.%roup9ayout.P47@7447DU$V7) )F layout.setHertical%roup( layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .add%roup(layout.create$euential%roup() .addo'ponent(Panel1, a/a.s!in.%roup9ayout.P47@7447DU$V7, 3S0, a/a.s!in.%roup9ayout.P47@7447DU$V7) .add%ap(0, 0, $hort.&UH& $hort.&UH&97)) )F
pac"()F MBB RBeditorfoldQ pri/ate /oid co'#o1&ctionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K BB T
pri/ate /oid #tn$earch&ctionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K $trin L tt/alue.etTet()F $trin 1L($trin)co'#o1.et$electedte'()F
K ueryLNselect G fro' hotel !here NCco'#o1.et$electedte'() CNLXNCtt/alue.etTet()CNXFNF delete()F 4esult$et rsLst't.eecute8uery(uery)F !hile(rs.net()) K $trin na'eLrs.et$trin(N=a'eN)F $trin phonenoLrs.et$trin(NPhonenoN)F $trin roo'noLrs.et$trin(N4oo'noN)F $trin roo'typeLrs.et$trin(N4oo'ty roo'typeLrs.et$trin(N4oo'typeN)F peN)F $trin noofdaysLrs.et$trin(N=oofdaysN)F $trin noofadultsLrs.et$trin(N=oofadultsN) noofadultsLrs.et$trin(N=oofadultsN)FF $trin noofchildrenLrs.et$trin(N=oofchildrenN)F 'odel.add4o!(ne! <#ectO Kna'e,phoneno,roo'no,roo'type,noofdays,noofadults,noofchildrenM)F M M M catch(7ception e)K ?
M catch (lass=ot@ound7ception e) K a/a.util.loin.9oer.et9oer(Aotel$earch.class.et=a'e()).lo(a/a.util.loin.9 a/a.util.loin.9oer.et9oer(Aotel$earch.class.et=a'e()).lo(a/a.util.loin.9 e/el.$7H747, null, e)F M catch (nstantiation7ception e) K a/a.util.loin.9oer.et9oer(Aotel$earch.class.et=a'e()).lo(a/a.util.loin.9 a/a.util.loin.9oer.et9oer(Aotel$earch.class.et=a'e()).lo(a/a.util.loin.9 e/el.$7H747, null, e)F M catch (lleal&ccess7ception e) K a/a.util.loin.9oer.et9oer(Aotel$earch.class.et=a'e()).lo(a/a.util.loin.9 a/a.util.loin.9oer.et9oer(Aotel$earch.class.et=a'e()).lo(a/a.util.loin.9 e/el.$7H747, null, e)F M catch (a/a.s!in.nsupported9oo"&nd@eel7ception e) K a/a.util.loin.9oer.et9oer(Aotel$earch.class.et=a'e()).lo(a/a.util.loin.9 a/a.util.loin.9oer.et9oer(Aotel$earch.class.et=a'e()).lo(a/a.util.loin.9 e/el.$7H747, null, e)F M BBRBeditorfoldQ BG reate and display the for' GB a/a.a!t.7/ent8ueue.in/o"e9ater(ne! 4unna#le() K pu#lic /oid run() K ne! Aotel$earch().setHisi#le(true)F Aotel$earch().setHisi#le(true)F M M)F M BB Haria#les aria#les declaration do not 'odify pri/ate a/a.s!in.?5utton #tn$earchF pri/ate a/a.s!in.?o'#o5o co'#o1F pri/ate a/a.s!in.?9a#el 9a#el1F pri/ate a/a.s!in.?9a#el 9a#el2F pri/ate a/a.s!in.?9a#el 9a#el3F pri/ate a/a.s!in.?9a#el 9a#elSF pri/ate a/a.s!in.?Panel Panel1F pri/ate a/a.s!in.?$crollPane $crollPane1F pri/ate a/a.s!in.?Ta#le a/a.s!in.?Ta#le t#hotelF pri/ate a/a.s!in.?Tet@ield a/a.s!in.?Tet@ield tt/alueF BB 7nd of /aria#les declaration M Dis;la< *nte!ace pac"ae effersonF
i'port a/a.sl.GF i'port a/a.s!in.?
G G Jauthor $tudent GB pu#lic class AotelDisplay etends a/a.s!in.?@ra'e K onnection conF $tate'ent st'tF DefaultTa#leodel DefaultTa#leodel 'odelF BGG G reates ne! for' AotelDisplay GB pu#lic AotelDisplay() K inito'ponents()F 'odelL(DefaultTa#leodel)t#hotel.etodel()F M /oid
$trin ueryLNselect G fro' hotelFNF 4esult$et rsLst't.eecute8uery(uery)F !hile(rs.net()) K $trin na'eLrs.et$trin(N=a'eN)F $trin phonenoLrs.et$trin(NPhonenoN)F $trin roo'noLrs.et$trin(N4oo'noN)F $trin roo'typeLrs.et$trin(N4oo'ty roo'typeLrs.et$trin(N4oo'typeN)F peN)F $trin noofdaysLrs.et$trin(N=oofdaysN)F $trin noofadultsLrs.et$trin(N=oofadultsN) noofadultsLrs.et$trin(N=oofadultsN)FF $trin noofchildrenLrs.et$trin(N=oofchildrenN)F
'odel.add4o!(ne! <#ectO Kna'e,phoneno,roo'no,roo'type,noofdays,noofadults,noofchildrenM)F M rs.close()F
st't.close()F con.close()F M catch(7ception e)K ?
M /oid delete() K int ro!sL'odel.et4o!ount()F if(ro!sQ0)K for(int iL0FiRro!sFiCC) K 'odel.re'o/e4o!(0)F M M M BGG G This 'ethod is called fro' fro' !ithin the constructor to initialiIe the for'. for'. G >&4= >&4==%: =%: Do =arnins(Nunchec"edN) BB Reditorfold defaultstateLNcollapsedN descLN%enerated odeNQ pri/ate /oid inito'ponents() K $crollPane1 L ne! a/a.s!in.?$crollPane()F t#hotel L ne! a/a.s!in.?Ta#le()F a/a.s!in.?Ta#le()F #tnDisplay L ne! a/a.s!in.?5utton()F 9a#el1 L ne! a/a.s!in.?9a#el()F
setDefaultloseindo!onstants.7TU<=U9<$7)F
t#hotel.setodel(ne! a/a.s!in.ta#le.DefaultT a/a.s!in.ta#le.DefaultTa#leodel( a#leodel( ne! <#ect OO K Knull, null, null, null, null, null, nullM, Knull, null, null, null, null, null, nullM, Knull, null, null, null, null, null, nullM, Knull, null, null, null, null, null, nullM M, ne! $trin O K N=a'eN, NPhone =o.N, N4oo' =o.N, N4oo' TypeN, TypeN, N=o. of daysN, N=o. of adultsN, N=o. of childrenN M ))F $crollPane1.setHie!portHie!(t#hotel)F #tnDisplay.set5ac"round(ne! #tnDisplay.set5ac"round(ne! a/a.a!t.olor(2++, 1+3, 1+3))F #tnDisplay.set@ont(ne! #tnDisplay.set@ont(ne! a/a.a!t.@ont(No'ic $ans $N, 1, 2S))F BB =<1-=
#tnDisplay.set@oreround(ne! #tnDisplay.set@oreround(ne! a/a.a!t.olor(1+3, 0, 0))F #tnDisplay.setcon(ne! a/a.s!in.'aecon(N:ZZsersZZ$tudentZZDes"topZZ001C#ac"roundCpatternCdesins. a/a.s!in.'aecon(N:ZZsersZZ$t udentZZDes"topZZ001C#ac"roundCpatternCdesins. pN))F BB =<1-= #tnDisplay.setursor(ne! #tnDisplay.setursor(ne! a/a.a!t.ursor(a/a.a!t.ursor a/a.a!t.ursor(a/a.a!t.ursor.D7@ .D7@&9 &9TU4$<4)) TU4$<4))FF #tnDisplay.add&ction9istener(ne! #tnDisplay.add&ction9istener(ne! a/a.a!t.e/ent.&ction9istener() K pu#lic /oid actionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K #tnDisplay&ctionPerfor'ed(e/t)F M M)F 9a#el1.setcon(ne! a/a.s!in.'aecon(N:ZZsersZZ$tudentZZDes"topZZ#ac"roundZZlo##y. a/a.s!in.'aecon(N:ZZsersZZ$t udentZZDes"topZZ#ac"roundZZlo##y.pN))F pN))F BB =<1-= a/a.s!in.%roup9ayout layout L ne! a/a.s!in.%roup9ayout(etontentPane())F etontentPane().set9ayout(layout)F layout.setAoriIontal%roup( layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .add%roup(layout.create$euential%roup() .addontainer%ap() .add%roup(layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .add%roup(layout.create$euential%roup() .addo'ponent(#tnDisplay, a/a.s!in.%roup9ayout.P47@7447DU$V7, 32-, a/a.s!in.%roup9ayout.P47@7447DU$V7) .add%ap(1-, 1-, 1-) .addo'ponent(9a#el1)) .addo'ponent($crollPane1, a/a.s!in.%roup9ayout.P47@7447DU$V7, 621, a/a.s!in.%roup9ayout.P47@7447DU$V7)) .add%ap(0, *, $hort.&UH& $hort.&UH&97)) )F layout.setHertical%roup( layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .add%roup(layout.create$euential%roup() .addontainer%ap() .addo'ponent($crollPane1, a/a.s!in.%roup9ayout.P47@7447DU$V7, *2, a/a.s!in.%roup9ayout.P47@7447DU$V7) .add%ap(S, S, S) .add%roup(layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%, false) .addo'ponent(9a#el1, a/a.s!in.%roup9ayout.D7@& a/a.s!in.%roup9ayout.D7@&9T 9TU$V7, U$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, $hort.&UH&9 $hort.&UH&97) 7) .addo'ponent(#tnDisplay,, a/a.s!in.%roup9ayout.P47@7447DU$V7, .addo'ponent(#tnDisplay 0, $hort.&UH&97))
.addontainer%ap(a/a.s!in.%roup9ayout.D7@&9TU$V7, $hort.&UH&97)) )F
pac"()F MBB RBeditorfoldQ
pri/ate /oid #tnDisplay&ctionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K sho!1()F M BGG G Jpara' ars the co''and line aru'ents GB pu#lic static /oid 'ain($trin arsO) K BG $et the =i'#us loo" and feel GB BBReditorfold defaultstateLNcollapsedN descLN 9oo" and feel settin code (optional) NQ BG f =i'#us (introduced in ?a/a $7 6) is not a/aila#le, stay !ith the default loo" and feel. G @or details see http:BBdo!nload.oracle.co'Ba/aseBtutorialBuis!inBloo"andfeelBplaf.ht'l GB try K for (a/a.s!in.anaer. (a/a.s!in.anaer.9oo"&nd@eelnfo 9oo"&nd@eelnfo info : a/a.s!in.anaer.etnstalled9oo"&nd@eels()) a/a.s!in.anaer. etnstalled9oo"&nd@eels()) K if (N=i'#usN.euals(info.et=a'e()) (N=i'#usN.euals(info.et=a'e()))) K a/a.s!in.anaer.set9oo"&nd@eel(info.etlass=a'e())F #rea"F M M M catch (lass=ot@ound7ception e) K a/a.util.loin.9oer.et9oer(AotelDisplay.class.et=a'e()).lo(a/a.util.loin.9 a/a.util.loin.9oer.et9oer(AotelDisplay. class.et=a'e()).lo(a/a.util.loin.9 e/el.$7H747, null, e)F M catch (nstantiation7ception e) K a/a.util.loin.9oer.et9oer(AotelDisplay.class.et=a'e()).lo(a/a.util.loin.9 a/a.util.loin.9oer.et9oer(AotelDisplay. class.et=a'e()).lo(a/a.util.loin.9 e/el.$7H747, null, e)F M catch (lleal&ccess7ception e) K a/a.util.loin.9oer.et9oer(AotelDisplay.class.et=a'e()).lo(a/a.util.loin.9 a/a.util.loin.9oer.et9oer(AotelDisplay. class.et=a'e()).lo(a/a.util.loin.9 e/el.$7H747, null, e)F M catch (a/a.s!in.nsupported9oo"&nd@eel7ception e) K a/a.util.loin.9oer.et9oer(AotelDisplay.class.et=a'e()).lo(a/a.util.loin.9 a/a.util.loin.9oer.et9oer(AotelDisplay. class.et=a'e()).lo(a/a.util.loin.9 e/el.$7H747, null, e)F M BBRBeditorfoldQ
BG reate and display the for' GB a/a.a!t.7/ent8ueue.in/o"e9ater(ne! 4unna#le() K pu#lic /oid run() K ne! AotelDisplay().setHisi#le(true)F AotelDisplay().setHisi#le(true)F M M)F M BB Haria#les aria#les declaration do not 'odify pri/ate a/a.s!in.?5utton #tnDisplayF pri/ate a/a.s!in.?9a#el 9a#el1F pri/ate a/a.s!in.?$crollPane $crollPane1F pri/ate a/a.s!in.?Ta#le a/a.s!in.?Ta#le t#hotelF BB 7nd of /aria#les declaration M %ain %enu pac"ae effersonF
BGG G G Jauthor $tudent GB pu#lic class Aotelain etends a/a.s!in.?@ra'e K Aotelanae'ent@or' h'1 L ne! Aotelanae'ent@or'()F Aotel$earch hs1 L ne! Aotel$earch()F AotelDisplay hd1 L ne! AotelDisplay()F BGG G reates ne! for' Aotelain GB pu#lic Aotelain() K inito'ponents()F M BGG G This 'ethod is called fro' fro' !ithin the constructor to initialiIe the for'. for'. G >&4= >&4==%: =%: Do =arnins(Nunchec"edN) BB Reditorfold defaultstateLNcollapsedN descLN%enerated odeNQ pri/ate /oid inito'ponents() K enu1 L ne! a/a.s!in.?enu()F 9a#el1 L ne! a/a.s!in.?9a#el()F enu5ar1 L ne! a/a.s!in.?enu5ar()F enu2 L ne! a/a.s!in.?enu()F
enute'1 L ne! a/a.s!in.?enute'()F enute'2 L ne! a/a.s!in.?enute'()F enute'3 L ne! a/a.s!in.?enute'()F
enu1.setTet(Nenu1N)F
setDefaultloseindo!onstants.7TU<=U9<$7)F
9a#el1.setcon(ne! a/a.s!in.'aecon(etlass().et4esource(NBeffersonBne!pac"aeBhotel.pN)))F a/a.s!in.'aecon(etlass().et4esource(NBef fersonBne!pac"aeBhotel.pN)))F BB =<1-=
enu2.setTet(NAotelN)F
enute'1.setTet(N7ntry enute'1.setTet(N7ntry @or'N)F enute'1.add&ction9istener(ne! a/a.a!t.e/ent.&ction9istener() K pu#lic /oid actionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K enute'1&ctionPerfor'ed(e/t)F M M)F enu2.add(enute'1)F
enute'2.setTet(N$earchN)F enute'2.add&ction9istener(ne! a/a.a!t.e/ent.&ction9istener() K pu#lic /oid actionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K enute'2&ctionPerfor'ed(e/t)F M M)F enu2.add(enute'2)F
enute'3.setTet(NHie!N)F enute'3.add&ction9istener(ne! a/a.a!t.e/ent.&ction9istener() K pu#lic /oid actionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K enute'3&ctionPerfor'ed(e/t)F M M)F enu2.add(enute'3)F
enu5ar1.add(enu2)F
set?enu5ar(enu5ar1)F
a/a.s!in.%roup9ayout layout L ne! a/a.s!in.%roup9ayout(etontentPane())F etontentPane().set9ayout(layout)F layout.setAoriIontal%roup( layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .addo'ponent(9a#el1) )F
layout.setHertical%roup( layout.createParallel%roup(a/a.s!in.%roup9ayout.&lin'ent.97&D=%) .addo'ponent(9a#el1, a/a.s!in.%roup9ayout.D7@& a/a.s!in.%roup9ayout.D7@&9T 9TU$V7, U$V7, a/a.s!in.%roup9ayout.D7@&9T a/a.s!in.%roup9ayout.D7@& 9TU$V7, U$V7, $hort.&UH&9 $hort.&UH&97) 7) )F
pac"()F MBB RBeditorfoldQ
pri/ate /oid enute'1&ctionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K h'1.sho!()F M pri/ate /oid enute'2&ctionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K hs1.sho!()F M pri/ate /oid enute'3&ctionPerfor'ed(a/a.a!t.e/ent.&ction7/ent e/t) K hd1.sho!()F M BGG G Jpara' ars the co''and line aru'ents GB pu#lic static /oid 'ain($trin arsO) K BG $et the =i'#us loo" and feel GB BBReditorfold defaultstateLNcollapsedN descLN 9oo" and feel settin code (optional) NQ BG f =i'#us (introduced in ?a/a $7 6) is not a/aila#le, stay !ith the default loo" and feel. G @or details see http:BBdo!nload.oracle.co'Ba/aseBtutorialBuis!inBloo"andfeelBplaf.ht'l GB try K for (a/a.s!in.anaer. (a/a.s!in.anaer.9oo"&nd@eelnfo 9oo"&nd@eelnfo info : a/a.s!in.anaer.etnstalled9oo"&nd@eels()) a/a.s!in.anaer. etnstalled9oo"&nd@eels()) K if (N=i'#usN.euals(info.et=a'e()) (N=i'#usN.euals(info.et=a'e()))) K a/a.s!in.anaer.set9oo"&nd@eel(info.etlass=a'e())F #rea"F M M M catch (lass=ot@ound7ception e) K a/a.util.loin.9oer.et9oer(Aotelain.class.et=a'e()).lo(a/a.util.loin.9e/ a/a.util.loin.9oer.et9oer(Aotelain.class.et=a'e()).lo(a/a.util.loin.9e/ el.$7H747, null, e)F M catch (nstantiation7ception e) K a/a.util.loin.9oer.et9oer(Aotelain.class.et=a'e()).lo(a/a.util.loin.9e/ a/a.util.loin.9oer.et9oer(Aotelain.class.et=a'e()).lo(a/a.util.loin.9e/ el.$7H747, null, e)F
M catch (lleal&ccess7ception e) K a/a.util.loin.9oer.et9oer(Aotelain.class.et=a'e()).lo(a/a.util.loin.9e/ a/a.util.loin.9oer.et9oer(Aotelain.class.et=a'e()).lo(a/a.util.loin.9e/ el.$7H747, null, e)F M catch (a/a.s!in.nsupported9oo"&nd@eel7ception e) K a/a.util.loin.9oer.et9oer(Aotelain.class.et=a'e()).lo(a/a.util.loin.9e/ a/a.util.loin.9oer.et9oer(Aotelain.class.et=a'e()).lo(a/a.util.loin.9e/ el.$7H747, null, e)F M BBRBeditorfoldQ BG reate and display the for' GB a/a.a!t.7/ent8ueue.in/o"e9ater(ne! 4unna#le() K pu#lic /oid run() K ne! Aotelain().setHisi#le(true) Aotelain().setHisi#le(true)FF M M)F M BB Haria#les aria#les declaration do not 'odify pri/ate a/a.s!in.?9a#el 9a#el1F pri/ate a/a.s!in.?enu enu1F pri/ate a/a.s!in.?enu enu2F pri/ate a/a.s!in.?enu5ar enu5ar1F pri/ate a/a.s!in.?enute' enute'1F pri/ate a/a.s!in.?enute' enute'2F pri/ate a/a.s!in.?enute' enute'3F BB 7nd of /aria#les declaration M GGGGGGG
'P-' .1 *n;ut !oms %ain %enu
6otel %anagement$nt<( 5om
Seach *nte!ace
Dis;la< *nte!ace
GGG