Professional Documents
Culture Documents
Project Report: Crime Management System
Project Report: Crime Management System
On
165339910
[I]
ACKNOWLEDGEMENT
At the outset, I thank God almighty for making my endeavor a success. I express my sincere
gratitude to Mr. Ashish Saxena for his constant support and valuable suggestions without which
the successful completion of this Dissertation would not have been possible. I express my
immense pleasure and thankfulness to Mr. Ashish Saxena and all the teachers and staff of the
Department of Computer Science and Engineering for their cooperation and support.
Finally, I am thankful to my classmates for their cooperation and support that helped me in the
successful completion of this work.
Prarthna Bahuguna
MCA 5th Sem
[II]
DECLARATION
I, Prarthna Bahuguna, student of M.C.A hereby declare that the project titled “CRIME
MANAGEMENT SYSTEM”, which is submitted by me to Dehradun Institute of Technology,
Dehradun, Uttarakhand, in partial fulfilment of requirement for the award of the degree of M.C.A, has not
been previously formed the basis for the award of any degree, diploma or other similar title or
recognition.
The author attests that permission has been obtained for the use of any copy righted material
appearing in the Dissertation / Project Report other than brief excerpts required only proper
acknowledgement in scholarly writing and all such use is acknowledged.
Prarthna Bahuguna
MCA -V
165339910
[III]
CERTIFICATE OF ORIGINALITY
This is to certify that this project entitled “CRIME MANAGEMENT SYSTEM ” submitted in partial
fulfillment of the degree of Master Of Computer Application to the DIT UNIVERSITY , Dehradun done
by project members is an authentic work carried out by him under my guidance. The matter embodied in
this project work has not been submitted earlier for award of any degree or diploma to the best of my
knowledge and belief.
[IV]
TABLE OF CONTENT
1. Introduction 1
2. Objectives 2
3. System Analysis
3.1 Identification of Need 3
4. System Design
4.1 File System design 12-13
5. Testing
5.1 Unit Testing 20
7. Reports 23
9. Appendices
9.1 Coding 25-58
9.2 Bibliography 59
1. INTRODUCTION OF THE PROJECT
The Crime Management System is a software application solution which is useful for the police
stations for handling information like add, view and update of a CRIMINAL and FIR.
The police station employee can add records in the database and can also view when needed.
When employee needs any record according to some specifications, the employee can view the
records.
The software not only saves the user’s time but it also reduces the paperwork. The records are
divided into three categories. The first one is crime record, change password and fir record.
Earlier, it was very difficult to maintain the records on pages manually, but with help of this
program we can solve the problem. Previously, if the user wants to search for any information
he/she has to go through number of pages, but he/she would not be able to find the records.
Many times they find that many pages of records get damaged or misplaced but with the
help of this project the user can keep the records safely and correctly. With the help of
this system user will be able to get the information as early as possible.
-1-
2. OBJECTIVE OF THE PROJECT
We can easily modify the present data as well as the previous data.
-2-
3. SYSTEM ANALYSIS
The software is developed for police stations. This software makes the management of police
station easy and fast. It will also reduce cost, increase efficiency and provide security. It will use
database to store data of the criminals and fir’s.
The user can view and update the information directly into the application software which is
more fast, efficient and less prone to errors. It will also reduce the paperwork which saves the
money as well.
The software uses the database to store the information of the records. The Software also has
change password option so if the user wants to change the password so he/she can easily change
the password.
-3-
3.2 Preliminary Investigation
During analysis, we investigated the current working process of the Crime Management
System in which we found out that the detail of the crimes and FIR’s related to police
station are being maintained in papers. There were different register. If any of the detail of a
criminal is required to be updated, then the in-charge person needs to manually find the
criminal detail in a register, then search for the criminal name and then update the
corresponding detail and highlight it to show that the record has been updated. This process
is slow, error prone, and requires slots of effort. When any person visits the police station,
then the police station needs to manually write the FIR which was again a very difficult
task. So, we need to develop an application that can overcome all these problems.
The proposed system needs to provide a simple interface that should allow the police
station person in-charge to easily maintain the FIR records and criminal records, allow them
to quickly search for the criminal or FIR whose details needs to be updated, and allow to
-4-
3.3 Feasibility Study
User Need
Feasibility study tried to determine whether a given solution would work or not its main
objective is not to serve the problem, but to acquire its scope its focus on following:
i) Technical feasibility
The system we intend to build require front end to interact with the user and a back end to
store the data like FIR record, criminal records, etc. The front-end will be designed in
Java Swing and Java Database (Apache-Derby Database) will be used in back-end. So the
The proposed system is economically feasible as the tools and platform we require are
available on the internet free of cost, like JDK (Java Development Kit), Text pad, Net
Beans, etc. These are openly available for everyone on various platforms like MS
-5-
iii) Operational feasibility
The system is operationally feasible as the application is a simple GUI application with
all the instructions provided to the user and all operations separated in different menu and
submenu. So, the users will find the system easy to operate and thus, the system is
operationally feasible.
-6-
3.4 Software Requirement Specification(SRS)
Introduction
The following subsections of the SRS document provide an overview of the entire SRS.
A. Purpose
The purpose of the project is to provide facility to the person in charge of police station so
that he can perform his\her work in an application instead of working in papers. The user
can maintain and update the details like, fir details, name, date, criminal number, name, date
B. Scope
The application will be used by the person in charge for maintaining and updating the FIR’s
records and criminal records, generate the list of FIR and criminals and updating those
details.
C. Benefits
This application reduces the complexity, maintaining accuracy, increasing efficiency and
saving time.
-7-
SOFTWARE SPECIFICATION USED
RAM – 2 GB
The software engineering paradigm applied in the system is waterfall model. Firstly,
requirement of the system were analyzed. What was needed to build the proposed system,
what were the initial requirements of the system was determined. Like, this system is used
by police station in charge, so we need to provide the menu as the intent of using the
application.
Then the system was designed on the basis of the requirement determined in the analysis
phase. The design includes the different menus and options that will be displayed to the
user. Like, menu for the criminal and FIR records will have options to add a criminal and
fir, View criminal and FIR Records, and Edit criminal and fir records.
-8-
3.6 Data Models
0-Level DFD
-9-
1-Level
- 10 -
2-Level DFD
- 11 -
4. SYSTEM DESIGN
1) USERTABLE
2) STUTABLE
- 12 -
3) FIRTABLE
- 13 -
Main Screen
- 14 -
Criminal Record
- 15 -
o View Criminal Records
- 16 -
o Update Criminal Records
- 17 -
Change password
- 18 -
FIR RECORDS
- 19 -
o Update FIR Record
- 20 -
5. TESTING
Each module is tested separately simultaneously along with the coding of the module to
check if the module is performing its task correctly. We checked if the module is behaving
properly according to the input given. All the modules that need to write data to file are
checked by opening the file, that if the data is being written into the file properly. For
example after coding the Add Criminal Record module, we check whether the data is being
stored in the Database table manually by executing SQL command. Similarly testing was
When all the modules of the system are put together, the system is tested against the system
requirement to see if the entire requirements are met and if the system performs as specified
by the requirement. When all the modules were integrated in the main frame the application
was functioning correctly. All modules were functioning correctly and performing all the
operations.
I have put my efforts to remove the bugs, but nothing is perfect in the world, so is with this
application.
- 21 -
5.3 Black Box Testing
We put this application under black box testing and checked whether the system is producing
correct output or not for the given input. We found that the system is producing the expected
We tested every module in detail, their output for different inputs and checked their behavior
when wrong inputs were given. For example if the user doesn’t filled all the information of
the Criminal then the message will appear that please enter all the details.
In case of the modules those store or retrieve data from the database, we checked that the
module behaved properly and data is being stored and retrieved in/from database correctly in
right format
- 22 -
6. SYSTEM SECURITY MEASURES
If someone is try to open this program with wrong password and id then the program will
- 23 -
7. REPORTS
Criminal Records
FIR Records
- 24 -
8. Future Scope & Further Enhancement
This application software can be further updated with new features. Project is flexible i.e. any
change / modification can be performed easily. In this many other module can be added so to
This application can be made web enabled so that anyone can report a FIR.
This application provides managing various information about Criminals and FIR but we
can also add the feature to provide the current status about the police station.
This application can also implement Thumb recognition or face detection technology for
- 25 -
9. APPENDICES
Source Code
o Login form
import java.sql.*;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
public Login() {
initComponents();
B();
setLocationRelativeTo(null);
getContentPane().add(l);
getContentPane().add(b);
- 26 -
private void initComponents() {
ID = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setResizable(false);
jLabel1.setText("LOGIN");
jLabel2.setText("User ID :");
jLabel3.setText("Password :");
LoginButton.setText("Login");
LoginButton.addActionListener(new java.awt.event.ActionListener() {
LoginButtonActionPerformed(evt);
});
- 27 -
ID.addActionListener(new java.awt.event.ActionListener() {
IDActionPerformed(evt);
});
exitButton.setText("Exit");
exitButton.addActionListener(new java.awt.event.ActionListener() {
exitButtonActionPerformed(evt);
});
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1))
- 28 -
.addGap(0, 182, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(LoginButton)
.addComponent(exitButton)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(ID, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pass, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(exitButton)
.addComponent(LoginButton))
.addContainerGap())
);
- 29 -
pack();
String id =ID.getText();
String p = pass.getText();
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
try {
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
String p1 = rs.getString("PASS");
if(id.equals(userid)&&p.equals(p1))
JOptionPane.showMessageDialog(null,"welcome");
new main().setVisible(true);
flag = true;
dispose();
- 30 -
}
if(!flag)
JOptionPane.showMessageDialog(null,"Wrong ID or Password");
dispose();
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
- 31 -
} catch (ClassNotFoundException ex) {
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new Login().setVisible(true);
});
Main Frame
- 32 -
import javax.swing.ImageIcon;
import javax.swing.JLabel;
public main() {
initComponents();
B();
setLocationRelativeTo(null);
getContentPane().add(b);
@SuppressWarnings("unchecked")
- 33 -
jMenu1 = new javax.swing.JMenu();
jDialog1.getContentPane().setLayout(jDialog1Layout);
jDialog1Layout.setHorizontalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
);
jDialog1Layout.setVerticalGroup(
jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
);
jMenuItem5.setText("jMenuItem5");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setResizable(false);
UpdateCrim.setText("Criminal Record");
AddCrim.setText("Add");
AddCrim.addActionListener(new java.awt.event.ActionListener() {
AddCrimActionPerformed(evt);
});
UpdateCrim.add(AddCrim);
- 34 -
viewCrim.setText("View");
viewCrim.addActionListener(new java.awt.event.ActionListener() {
viewCrimActionPerformed(evt);
});
UpdateCrim.add(viewCrim);
updateCrim.setText("Update");
updateCrim.addActionListener(new java.awt.event.ActionListener() {
updateCrimActionPerformed(evt);
});
UpdateCrim.add(updateCrim);
jMenuBar1.add(UpdateCrim);
jMenu3.setText("Change Password");
ChangePassword.setText("Change");
ChangePassword.addActionListener(new java.awt.event.ActionListener() {
ChangePasswordActionPerformed(evt);
});
jMenu3.add(ChangePassword);
jMenuBar1.add(jMenu3);
- 35 -
jMenu1.setText("FIR");
AddFir.setText("Add");
AddFir.addActionListener(new java.awt.event.ActionListener() {
AddFirActionPerformed(evt);
});
jMenu1.add(AddFir);
viewFir.setText("View");
viewFir.addActionListener(new java.awt.event.ActionListener() {
viewFirActionPerformed(evt);
});
jMenu1.add(viewFir);
Udatefir.setText("Update");
Udatefir.addActionListener(new java.awt.event.ActionListener() {
UdatefirActionPerformed(evt);
});
jMenu1.add(Udatefir);
jMenuBar1.add(jMenu1);
setJMenuBar(jMenuBar1);
- 36 -
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
);
pack();
}// </editor-fold>
new UpdateFIR().setVisible(true);
new ViewFIR().setVisible(true);
new Fir().setVisible(true);
- 37 -
private void AddCrimActionPerformed(java.awt.event.ActionEvent evt) {
new newcriminal().setVisible(true);
new ViewCriminal().setVisible(true);
new Updatecriminal().setVisible(true);
new ChangePassword().setVisible(true);
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
- 38 -
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new main().setVisible(true);
});
- 39 -
private javax.swing.JMenu jMenu3;
New criminal
import datePackage.DateLabelFormatter;
import java.awt.event.KeyEvent;
import java.sql.*;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import org.jdatepicker.impl.JDatePanelImpl;
import org.jdatepicker.impl.JDatePickerImpl;
import org.jdatepicker.impl.SqlDateModel;
/*
*/
- 40 -
/**
* @author prarthana
*/
JDatePanelImpl datePanel1,datePanel2,datePanel3;
JDatePickerImpl datePicker1,datePicker2,datePicker3;
public newcriminal() {
initComponents();
init2();
B();
getContentPane().add(l);
getContentPane().add(b);
- 41 -
dateModel1 = new SqlDateModel();
p.put("text.today", "Today");
p.put("text.month", "Month");
p.put("text.year", "Year");
getContentPane().add(datePicker1);
getContentPane().add(datePicker2);
getContentPane().add(datePicker3);
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
*/
@SuppressWarnings("unchecked")
- 42 -
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- 43 -
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("Name :");
jLabel3.setText("Gender :");
jLabel4.setText("D.O.B :");
jLabel5.setText("Address :");
jLabel6.setText("Occupation :");
jLabel8.setText("Punishment :");
CloseCriminal.setText("Close");
CloseCriminal.addActionListener(new java.awt.event.ActionListener() {
CloseCriminalActionPerformed(evt);
});
NameTextField.addKeyListener(new java.awt.event.KeyAdapter() {
- 44 -
public void keyTyped(java.awt.event.KeyEvent evt) {
NameTextFieldKeyTyped(evt);
});
mRadioB.setSelected(true);
mRadioB.setText("Male");
mRadioB.addActionListener(new java.awt.event.ActionListener() {
mRadioBActionPerformed(evt);
});
fRadioB.setText("Female");
fRadioB.addActionListener(new java.awt.event.ActionListener() {
fRadioBActionPerformed(evt);
});
OccupationTextField.setEditable(false);
OccupationTextField.addActionListener(new java.awt.event.ActionListener() {
OccupationTextFieldActionPerformed(evt);
});
OccupationTextField.addKeyListener(new java.awt.event.KeyAdapter() {
- 45 -
OccupationTextFieldKeyTyped(evt);
});
typeofcrimTextField.addActionListener(new java.awt.event.ActionListener() {
typeofcrimTextFieldActionPerformed(evt);
});
arrestlocationTextField.addActionListener(new java.awt.event.ActionListener() {
arrestlocationTextFieldActionPerformed(evt);
});
DetailsOfCrimTextField.setColumns(20);
DetailsOfCrimTextField.setRows(5);
jScrollPane2.setViewportView(DetailsOfCrimTextField);
- 46 -
jLabel12.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
addbutton.setText("ADD");
addbutton.addActionListener(new java.awt.event.ActionListener() {
addbuttonActionPerformed(evt);
});
unemp.setSelected(true);
unemp.setText("Unemployed");
unemp.addActionListener(new java.awt.event.ActionListener() {
unempActionPerformed(evt);
});
emp.setText("Employed");
emp.addActionListener(new java.awt.event.ActionListener() {
empActionPerformed(evt);
});
jLabel13.setText("Locker Number:");
- 47 -
jLabel14.setForeground(new java.awt.Color(255, 255, 255));
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel14)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING)))))
- 48 -
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(mRadioB)
.addComponent(fRadioB)
.addContainerGap(352, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(unemp)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(emp))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(addbutton)
.addComponent(CloseCriminal))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(NameTextField, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(addTextField, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(typeofcrimTextField,
javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(arrestlocationTextField,
javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(PunishmentTextField,
javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2)
.addComponent(OccupationTextField,
javax.swing.GroupLayout.Alignment.LEADING)
- 49 -
.addComponent(lockerNumField,
javax.swing.GroupLayout.Alignment.LEADING))))
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel12)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(NameTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(fRadioB)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(mRadioB)
.addComponent(jLabel3)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- 50 -
.addComponent(addTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel4)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(unemp)
.addComponent(emp)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(OccupationTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(typeofcrimTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel9)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(arrestlocationTextField,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(PunishmentTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel8))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- 51 -
.addComponent(lockerNumField, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel13))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel14)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel10))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(CloseCriminal)
.addComponent(addbutton))
.addContainerGap())
);
pack();
}// </editor-fold>
dispose();
- 52 -
fRadioB.setSelected(false);
mRadioB.setSelected(false);
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
try {
- 53 -
String gender;
if(mRadioB.isSelected()==true)
gender="Male";
else
gender="Female";
+ "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
stmt.setString(1,NameTextField.getText());
stmt.setString(2,gender);
stmt.setDate(3,dob);
stmt.setString(4,addTextField.getText());
if(unemp.isSelected()==true)
stmt.setString(5,"Unemployed");
else
stmt.setString(5,OccupationTextField.getText());
stmt.setString(6,typeofcrimTextField.getSelectedItem().toString());
stmt.setDate(7,arr);
stmt.setString(8,arrestlocationTextField.getText());
stmt.setString(9,PunishmentTextField.getText());
stmt.setString(10,lockerNumField.getText());
stmt.setDate(11,reldate);
stmt.setString(12,DetailsOfCrimTextField.getText());
stmt.executeUpdate();
- 54 -
JOptionPane.showMessageDialog(null, "Record Added");
dispose();
char c = evt.getKeyChar();
if(!Character.isAlphabetic(c)&& (c != KeyEvent.VK_BACK_SPACE)&& (c !=
KeyEvent.VK_SPACE)) {
evt.consume();
getToolkit().beep();
char c = evt.getKeyChar();
if(!Character.isAlphabetic(c)&& (c != KeyEvent.VK_BACK_SPACE)&& (c !=
KeyEvent.VK_SPACE)){
evt.consume();
getToolkit().beep();
if(emp.isSelected()==false)
- 55 -
{
unemp.setSelected(true);
OccupationTextField.setEditable(false);
OccupationTextField.setText("");
else
unemp.setSelected(false);
OccupationTextField.setEditable(true);
if(unemp.isSelected()==true)
emp.setSelected(false);
OccupationTextField.setEditable(false);
OccupationTextField.setText("");
else
emp.setSelected(true);
OccupationTextField.setEditable(true);
- 56 -
public static void main(String args[]) {
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(newcriminal.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
java.util.logging.Logger.getLogger(newcriminal.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
java.util.logging.Logger.getLogger(newcriminal.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
java.util.logging.Logger.getLogger(newcriminal.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
//</editor-fold>
- 57 -
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
new newcriminal().setVisible(true);
});
- 58 -
Bibliography
2) Website – www.tutorialpoint.com/swing
3) Website – www.javapoint.com/java-swing
4) Website – www.codejava.net/java-se/jdbc/connect-to-apache-derby-java-
db-via-jdbc
- 59 -