Content beyond the Syllabus Library management system project in JAVA

Project category : RDBMS Language and software tool used :
  

Front End : Java Operating System : Window 7 Back End : Microsoft SQL Server 2005

Structure of the project: Proposed System: In the proposed system, we assume that each member will be having a identity card which can be used for the library book issue, fine payment etc. whenever library member wish to take a book, the book issued by the library authority will be check both the book details as well as the student details and store it in library database. In case of retrieval of book much of human intervention can be eliminated. Module Description: 1. User Module: In this module student can check availability of the book… The following are the sub module in the user module.

Book return: Here student will return the books to the library…

2. Administrator Module: This is the main module in the proposed project. The administrator can read and write information about any member. The administrator can also update, create and delete the record of membership as per requirement and implementation plans. The following are the sub module in the administrator module.

Register student: Allow the administrator to register new student and update the student records. Book details: Allow administrator to entered book details. Book issue: Here administrator issues the books to the student from library.

 

Future scope of the project: We can consider much future scope to this application. The following are some of there.
  

Online use of the library can be good feature for the Library Management system. Advanced fine payment system can be added. Inventory system can be used to maintain the books of the library.

Hardware requirement :
  

Operating system: Window 7 Hard disks: 40GB RAM: 256 MB

Software requirement :
   

Java language Net beans IDE 7.0.1 MS SQL server 2005
import import import import import import import import import import java.util.*; java.text.*; java.sql.*; java.awt.*; java.awt.event.*; javax.swing.*; javax.swing.event.*; javax.swing.border.*; javax.swing.table.*; javax.swing.plaf.metal.*;

public class frmBooks extends JInternalFrame implements ActionListener { public static JScrollPane BooksTblJSP = new JScrollPane(); public static JPanel jpnlMain = new JPanel(); public static JTable JTBooksTbl; Connection cnBooks; public static Statement stmtBooks; public static ResultSet rsBooks; public static String sSQL; public static String Content[][]; public static int rowNum = 0; public static int total = 0; boolean goEOF; Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); //JButton Variables JButton bttnAddNew = new JButton("Add New",new ImageIcon("@imgs/add new.gif")); JButton bttnEdit = new JButton("Edit", new ImageIcon("@imgs/edit.gif")); //Recordset

JButton bttnRemove = new JButton("Remove", new ImageIcon("@imgs/remove.gif")); JButton bttnSearch = new JButton("Search", new ImageIcon("@imgs/search.gif")); JButton bttnPreview = new JButton("Preview",new ImageIcon("@imgs/preview.gif")); JButton bttnRefresh = new JButton("Refresh",new ImageIcon("@imgs/refresh.gif")); JButton bttnExit = new JButton("Cancel", new ImageIcon("@imgs/cancel.gif")); //JLabel Variables JLabel lblHeader = new JLabel(); JLabel lblIcon = new JLabel(); JLabel lblCaption = new JLabel("NOTE: This form contains all information about the Book Records."); JFrame JFParentFrame; mdlFunctions module_func = new mdlFunctions(); mdlSQLStatements module_sql = new mdlSQLStatements(); public frmBooks(Connection conn, JFrame getParentFrame) throws SQLException { super("Books Records",false,true,false,true); jpnlMain.setBackground(Color.WHITE); jpnlMain.setLayout(null); JFParentFrame = getParentFrame; cnBooks = conn; stmtBooks = cnBooks.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CON CUR_READ_ONLY); sSQL = "SELECT * FROM qryBooks ORDER BY BookNo ASC"; //-- Add the Table JTBooksTbl = CreateTable(); BooksTblJSP.getViewport().add(JTBooksTbl); BooksTblJSP.setBounds(5,55,708,323); jpnlMain.add(BooksTblJSP); module_func.setJButton(bttnAddNew,5,390,105,25,"add","Add New"); bttnAddNew.setMnemonic(KeyEvent.VK_A); bttnAddNew.addActionListener(JBActionListener); module_func.setJButton(bttnEdit,112,390,99,25,"edit","Edit"); bttnEdit.setMnemonic(KeyEvent.VK_E); bttnEdit.addActionListener(JBActionListener); module_func.setJButton(bttnRemove,212,390,100,25,"remove","Remo ve"); bttnRemove.setMnemonic(KeyEvent.VK_R); bttnRemove.addActionListener(JBActionListener); module_func.setJButton(bttnSearch,313,390,99,25,"search","Searc h"); bttnSearch.setMnemonic(KeyEvent.VK_S);

bttnSearch.addActionListener(JBActionListener); module_func.setJButton(bttnPreview,414,390,99,25,"preview","Pre view"); bttnPreview.setMnemonic(KeyEvent.VK_P); bttnPreview.addActionListener(JBActionListener); module_func.setJButton(bttnRefresh,514,390,99,25,"refresh","Ref resh"); bttnRefresh.setMnemonic(KeyEvent.VK_R); bttnRefresh.addActionListener(JBActionListener); module_func.setJButton(bttnExit,614,390,99,25,"exit","Unload Form"); bttnExit.setMnemonic(KeyEvent.VK_C); bttnExit.addActionListener(JBActionListener); lblHeader.setIcon(new ImageIcon("@imgs/Barrowers Records.gif")); lblIcon.setIcon(new ImageIcon("@imgs/bookslist.gif")); module_func.setJLabel(lblHeader,0,0,750,40); module_func.setJLabel(lblIcon,5,2,50,40); module_func.setJLabel(lblCaption,60,2,500,40); lblCaption.setFont(new Font("Dialog", Font.BOLD, 12)); lblCaption.setForeground(new Color(255,255,255)); //Add Labels jpnlMain.add(lblCaption); jpnlMain.add(lblIcon); jpnlMain.add(lblHeader); //Add Buttons jpnlMain.add(bttnAddNew); jpnlMain.add(bttnEdit); jpnlMain.add(bttnRemove); jpnlMain.add(bttnSearch); jpnlMain.add(bttnPreview); jpnlMain.add(bttnRefresh); jpnlMain.add(bttnExit); getContentPane().setLayout(new BorderLayout(0,0)); getContentPane().add(BorderLayout.CENTER, jpnlMain); setFrameIcon(new ImageIcon("@imgs/Books.gif")); setSize(728,450); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setLocation((screen.width - 728)/2,((screen.height-450)/2)-45); } ActionListener JBActionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String srcObj = e.getActionCommand(); if(srcObj=="add") { JDialog JDAdd = new frmAddEditBooks(true,JFParentFrame,cnBooks,""); JDAdd.show(); }

else if(srcObj=="edit") { if(total != 0){ try { if(JTBooksTbl.getValueAt(JTBooksTbl.getSelected Row(),JTBooksTbl.getSelectedColumn()) != null) { JDialog JDEdit = new frmAddEditBooks(false,JFParentFrame,cnBooks,"SELECT * FROM qryBooks WHERE BookNo ='" + JTBooksTbl.getValueAt(JTBooksTbl.getSelectedRow(),0) + "'"); JDEdit.show(); } } catch(Exception sqlE) { if(sqlE.getMessage() != null){System.out.println(sqlE.getMessage());} else { JOptionPane.showMessageDialog(null,"Please select a record in the list to modify.","No Record Selected",JOptionPane.INFORMATION_MESSAGE); } } } } else if(srcObj=="remove") { if(total != 0){ try { if(JTBooksTbl.getValueAt(JTBooksTbl.getSelected Row(),JTBooksTbl.getSelectedColumn()) != null) { String ObjButtons[] = {"Yes","No"}; int PromptResult = JOptionPane.showOptionDialog(null,"Are you sure you want to removed " + JTBooksTbl.getValueAt(JTBooksTbl.getSelectedRow(),2) + " in the record?","Delete Record",JOptionPane.DEFAULT_OPTION,JOptionPane.ERROR_MESSAGE,null,ObjBu ttons,ObjButtons[1]); if(PromptResult==0) { module_sql.recREMOVE(true, stmtBooks,"qryBooks", "BookNo", JTBooksTbl,0); reloadRecord(sSQL); JOptionPane.showMessageDialog(null,"Rec ord has been successfully removed.","Comfirm Delete",JOptionPane.INFORMATION_MESSAGE); } } } catch(Exception sqlE) { if(sqlE.getMessage()!=null) { JOptionPane.showMessageDialog(null,"You cannot delete this Book because it is being used by another user.\nIn

order to delete this book, delete its data from another table.","Comfirm Delete",JOptionPane.WARNING_MESSAGE); } else { JOptionPane.showMessageDialog(null,"Please select a record in the list to deleted.","No Record Selected",JOptionPane.INFORMATION_MESSAGE); } } } } else if(srcObj=="search") { JDialog JDSearch = new frmSearch(JFParentFrame, "Books"); JDSearch.show(); } else if(srcObj == "refresh"){reloadRecord("SELECT * FROM qryBooks ORDER BY BookNo ASC");} else if(srcObj=="exit"){dispose();} } }; public static JTable CreateTable(){ String ColumnHeaderName[] = { "Book Number","ISBN","Title","Author", "Category" }; try{ rsBooks = stmtBooks.executeQuery(sSQL); total = 0; //Move to the last record rsBooks.afterLast(); //Get the current record position if(rsBooks.previous())total = rsBooks.getRow(); //Move back to the first record; rsBooks.beforeFirst(); if(total != 0){ Content = new String[total][5]; while(rsBooks.next()) { Content[rowNum][0] = "" + rsBooks.getString("BookNo"); Content[rowNum][1] = "" + rsBooks.getString("ISBN"); Content[rowNum][2] = "" + rsBooks.getString("Title"); Content[rowNum][3] = "" + rsBooks.getString("Author"); Content[rowNum][4] = "" + rsBooks.getString("Category"); rowNum++; } }else{ Content = new String[0][5]; Content[0][0] = " "; Content[0][1] = " "; Content[0][2] = " "; Content[0][3] = " "; Content[0][4] = " "; }

}catch(Exception eE){ } JTable NewTable = new JTable (Content,ColumnHeaderName){ public boolean isCellEditable (int iRows, int iCols) { return false; } }; NewTable.setPreferredScrollableViewportSize(new Dimension(708, 323)); NewTable.setBackground(Color.white); //Start resize the table column NewTable.getColumnModel().getColumn(0).setMinWidth(0); NewTable.getColumnModel().getColumn(0).setPreferredWidth(100); NewTable.getColumnModel().getColumn(1).setPreferredWidth(100); NewTable.getColumnModel().getColumn(2).setPreferredWidth(150); NewTable.getColumnModel().getColumn(3).setPreferredWidth(100); //End resize the table column //Disposed variables ColumnHeaderName=null; Content=null; rowNum = 0; return NewTable; } public static void reloadRecord(String srcSQL) { sSQL = srcSQL; BooksTblJSP.getViewport().remove(JTBooksTbl); JTBooksTbl=CreateTable(); BooksTblJSP.getViewport().add(JTBooksTbl); jpnlMain.repaint(); } public void actionPerformed(ActionEvent event) { setVisible(false); dispose(); } }

Sign up to vote on this title
UsefulNot useful