This document provides a description and overview of a program designed to manage a library. The program has a graphical user interface with multiple windows. The first window allows a user to log in as a normal user or staff user. Normal users can search for books by title or author and view availability. Staff users can search, add, delete, update books in the library stock and check books in and out. The program uses classes to manage the GUI, user login/authentication, and book data. Functionality includes searching, adding, updating, deleting books as well as checking books in and out.
1. ATHLONE IT
Java Project 4-2
Final report
Dmitrius ponomarenko
11-Mar-15
Athlone IT,NetworkManagement&CloudInfrastructure 4,Software Design4-2
2. Description
The program designedto presentmultifunctional interface forthe libraryusers.The programhasa
multiple windows.The firstwindowwill give the choice forusertologinasa normal user or as a staff
user.To loginas a registereduser,the userwillbe requiredenterusername and password. If userhas
not beenregisteredeat,itwill needcreate hisaccountandthenloginas a registereduser. Afterlogin
success,the usual userwill getaccessto the interface whichallow him/hersearchthe librarybya book
title orauthor name, checkthe numberof available copiesandtheylocation.The staff will cana search/
add/delete/updatethe booksinthe librarystock,handoutor take back the books.
Program architecture
Main frame
Welcome Frame
User login Frame
Usernames and
passwords
collection
Staff login Frame
Username and
password
collection
class
UserName
Password
Class
UserName
Password
Staff Frame
Books collection
Class Books
User Frame
Use book
collection
3. Using classes
GUI Frames
Welcome Frame
UserLoginFrame
StaffLoginFrame
UserFrame
StaffFrame
Collectionclasses
UserNamePassword
Books
PopupWindows
InfoFrame
searchBooks
Functionality
1. WelcomeFrame (mainframe),give a
choice loginasa useror as a staff worker.To
loginasa libraryuserpress<user>button,to
loginasa staff press<staff>button.
The <user> buttonwill call UserLoginFrame
class,see codesbellow,the <staff>button
will call StaffLoginFrame class,see codes
bellow:
4. textField
textField_1
JButton
2. In staff loginframe, youneed enterusername in<textField>window andpasswordin
<textField_1>window andpress<Login>button. The buttonwill runthe search(string,string)
function,the <search>functionwill check<UserNamePassword>collectionformatchesandif it
foundthe match itwill call <StaffFrame>if there nomatchesthe userwill get warningmessage
that his/herusername orpassword isincorrectandwill be asked torepeatprocedure,see codes
above.
The user loginframe hasa similarfunctionality withone extrafunction.Thisfunctionallowfor
newusercreate hisaccount. The new usermust enterthe username that he/she willuse inthe
future andpasswordand press<New User> button.The <New User> buttonwill make actionto
add newusername andpassword intothe <UserNamePassword>collection,see codesbellow.
5. 3. In the <StaffFrame>usercan searchlibrarystock bya booktitle orauthor name. To searchby
title orauthor name userhave enterthe booktitle or authorname to the <fieldText>window
and presssearchbutton. The search buttonwill call the searchfunctions,the firstwillcheckthe
librarybythe booktitle andif bookwill found displayAuthorname in<textField_1>, Title in
<textField_2>,total numbof copiesin<textField_3>,numbrof available copiesin<textField_4>
and booklocationin<textField_5>.If bookwasnot foundbya title thenthe programwill run
secondsearchfunctionwhichwill make asearchbyauthor name and if foundwill store each
bookof thisauthorin a List andthendisplayedinpopupwindow.
See codesbellow:
6. JMenuBarwhit
insert/delete/update
items
textField
textField_1
textField_2
textField_3
textField_4
textField_5
comboBox (1-10)
textField_6
Group of JRadioButtons
If the userwill needstoupdate the librarystock,forexampledelete orupdate existingbook,itswill
have firstsearchfor that bookand if successthenuser can delete thatbookbyclicking<delete>inthe
top rightcorner menu.The <update>functionallow foruserupdate existingbooknumberof copiesand
booklocation,Toupdate bookuserwill needsearchforthat bookand itwill foundthenchange number
of copiesbyselectingnewnumberfrom<comboBox>(1-10) andenternew locationtothe
<textField_6>andpress<update> inthe top rightcorner <CRUD> menu.To addnew bok into the
librarystockthe user will needenter Authorname in<textField_1>,title in<textField_2>, total numbof
copiesin<textField_3>,numberof availablecopiesin<textField_4>and booklocationin<textField_5>
and press<insert>inthe <CRUD> menu.
See codesbellow:
8. Alsothe staff workerwill be responsible forhandoutthe booksfor usersandtakingthemback. To hand
out the bookthe staff userwill needfirstsearchstockforthat book,if foundtickthe <take book>
RadioButton andpress<Take/Return>button.The programwill extractone fromnumberof available
booksand save itas a newavailable number.If there isnoavailablecopiesinthe stockthe programwill
displaywarningmessage.If the userwantreturnthe bookback to the library,the staff workerwill need
searchstock for that bookandthentick the <return book> RadioButtonandpress<Take/Return>
button.The program will addsone copyto the existingnumberof copiesandsave new value.Toclear
all entriesuserneedpress<clier>button,toexitpress<exit>button.
4. The UserFrame will allowforlibrarycustomersearchthe booksinthe stockby Authorname or
booktitle.The UserFrame will use existingBookHashSet.Afterpress<search>buttonthe
program will create newobjectof StaffFrame classwhichwill lettouse <search> and <display>
functionsfromStaffFrame class.
See codesbellow:
9. Other
In thisassignmentwere usedfew extrajavafurthersuch as,<DefaulListModel>thatisa implementation
of the ListModel thatextendsfromAbstractListModel. Thisallow store datatothe JList andthen display
it.AlsoI use the ButtonGroupfurtherof java .The ButtonGroupclassis responsible tomake sure only
one buttonis selected(bydeselectingothersinthe group).
Conclusion
OverthisassignmentIgota goodbasic knowledge of Javaprograming,whichwillactas a good
foundationforcontinuingforthe Javasubject.