Crime Control App with Project Report (Using Java Swing)
Crime Control App with Project Report (Using Java Swing)
Introduction
“Crime Control” is an application software which is
making for controlling the crime rate and our cops can give there service
quickly. People also can use this software for taking Fire Service and
Ambulance service quickly. People can use this software with their smartphone. "Crime Control" App is make by java swing.
In this software have three major fixtures
and the fixtures are:
1.
Sharing
Location.
2.
Emergency
Call.
3.
Giving
Report.
i)
Can
send a message.
ii)
Uploading
photo.
iii)
Uploading
location.
We also create a test server for testing the output results. The main application will be installed in user smartphone and the server program will be installed in our 999 help centre and every police station’s server room. This application is too easy to use for general people.
Github Link: https://github.com/Mhossain028/Crime-Control-App
My project paper: https://rb.gy/lvioxl
My Github profile: https://github.com/Mhossain028
BuuuGs Facebook Page: https://www.facebook.com/buuugs.programming.blog
Appendix
Crime_Controll.java
package Crime_Control;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.awt.event.ActionEvent;
import java.awt.Font;
import java.awt.Color;
public class Crime_Control {
private
JFrame frame;
private
JTextField txtCrimeControl;
/**
* Launch the application.
*/
public
static void main(String[]args) {
EventQueue.invokeLater(new
Runnable() {
public
void run() {
try
{
Crime_Control
window = new Crime_Control();
window.frame.setVisible(true);
}
catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public
Crime_Control() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private
void initialize() {
frame
= new JFrame();
frame.setBounds(100,
100, 300, 479);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
txtCrimeControl
= new JTextField();
txtCrimeControl.setForeground(Color.RED);
txtCrimeControl.setBackground(Color.BLACK);
txtCrimeControl.setFont(new
Font("Tahoma", Font.BOLD | Font.ITALIC, 19));
txtCrimeControl.setText("Crime
Control Application ");
txtCrimeControl.setBounds(12,
52, 258, 80);
frame.getContentPane().add(txtCrimeControl);
txtCrimeControl.setColumns(10);
JButton
btnEmergencyCall = new JButton("Emergency call");
btnEmergencyCall.setBackground(Color.RED);
btnEmergencyCall.setForeground(Color.WHITE);
btnEmergencyCall.setFont(new
Font("Tahoma", Font.BOLD, 18));
btnEmergencyCall.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
CallButton
X=new CallButton();
X.NewScreenCall();
}
});
btnEmergencyCall.setBounds(56,
167, 177, 56);
frame.getContentPane().add(btnEmergencyCall);
JButton
btnShareLocation = new JButton("Share Location");
btnShareLocation.setFont(new
Font("Tahoma", Font.BOLD, 19));
btnShareLocation.setForeground(Color.WHITE);
btnShareLocation.setBackground(new
Color(255, 255, 0));
btnShareLocation.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent arg0) {
Fifthpage
D=new Fifthpage();
try
{
Fifthpage.New();
}
catch (Exception e) {
//
TODO Auto-generated catch block
e.printStackTrace();
}
Cli1
X=new Cli1();
try
{
Cli1.C();
}
catch (IOException e) {
//
TODO Auto-generated catch block
e.printStackTrace();
}
}
});
btnShareLocation.setBounds(56,
250, 177, 56);
frame.getContentPane().add(btnShareLocation);
JButton
btnReport = new JButton("Report Crime");
btnReport.setForeground(Color.WHITE);
btnReport.setBackground(Color.BLUE);
btnReport.setFont(new
Font("Tahoma", Font.BOLD, 19));
btnReport.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
secondpage
nw=new secondpage();
nw.Newscreen();
}
});
btnReport.setBounds(56,
335, 177, 56);
frame.getContentPane().add(btnReport);
}
}
CallButton.java
package Crime_Control;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.JRadioButton;
import javax.swing.JCheckBox;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.awt.event.ActionEvent;
import javax.swing.SwingConstants;
import java.awt.Font;
import java.awt.Color;
public class CallButton {
private
JFrame frame;
/**
* Launch the application.
*/
public
static void NewScreenCall() {
EventQueue.invokeLater(new
Runnable() {
public
void run() {
try
{
CallButton
window = new CallButton();
window.frame.setVisible(true);
}
catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public
CallButton() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private
void initialize() {
frame
= new JFrame();
frame.setBounds(100,
100, 300, 479);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JTextArea
textArea_1 = new JTextArea();
textArea_1.setForeground(new
Color(0, 0, 0));
textArea_1.setTabSize(5);
textArea_1.setLineWrap(true);
textArea_1.setBounds(12,
13, 258, 42);
frame.getContentPane().add(textArea_1);
JButton
button = new JButton("1");
button.setForeground(Color.WHITE);
button.setBackground(Color.DARK_GRAY);
button.setFont(new
Font("Tahoma", Font.BOLD, 25));
button.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent arg0) {
String
EnterNumbe=textArea_1.getText() + button.getText();
textArea_1.setText(EnterNumbe);
}
});
button.setBounds(12,
68, 61, 42);
frame.getContentPane().add(button);
JButton
btnNewButton = new JButton("2");
btnNewButton.setForeground(Color.WHITE);
btnNewButton.setBackground(Color.DARK_GRAY);
btnNewButton.setFont(new
Font("Tahoma", Font.BOLD, 25));
btnNewButton.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent arg0) {
String
EnterNumbe=textArea_1.getText() + btnNewButton.getText();
textArea_1.setText(EnterNumbe);
}
});
btnNewButton.setBounds(110,
68, 61, 42);
frame.getContentPane().add(btnNewButton);
JButton
btnNewButton_1 = new JButton("3");
btnNewButton_1.setForeground(Color.WHITE);
btnNewButton_1.setBackground(Color.DARK_GRAY);
btnNewButton_1.setFont(new
Font("Tahoma", Font.BOLD, 25));
btnNewButton_1.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
String
EnterNumbe=textArea_1.getText() + btnNewButton_1.getText();
textArea_1.setText(EnterNumbe);
}
});
btnNewButton_1.setBounds(209,
68, 61, 42);
frame.getContentPane().add(btnNewButton_1);
JButton
btnNewButton_2 = new JButton("4");
btnNewButton_2.setForeground(Color.WHITE);
btnNewButton_2.setBackground(Color.DARK_GRAY);
btnNewButton_2.setFont(new
Font("Tahoma", Font.BOLD, 25));
btnNewButton_2.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
String
EnterNumbe=textArea_1.getText() + btnNewButton_2.getText();
textArea_1.setText(EnterNumbe);
}
});
btnNewButton_2.setBounds(12,
123, 61, 42);
frame.getContentPane().add(btnNewButton_2);
JButton
button_1 = new JButton("5");
button_1.setForeground(Color.WHITE);
button_1.setBackground(Color.DARK_GRAY);
button_1.setFont(new
Font("Tahoma", Font.BOLD, 25));
button_1.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
String
EnterNumbe=textArea_1.getText() + button_1.getText();
textArea_1.setText(EnterNumbe);
}
});
button_1.setBounds(110,
123, 61, 42);
frame.getContentPane().add(button_1);
JButton
button_2 = new JButton("6");
button_2.setBackground(Color.DARK_GRAY);
button_2.setForeground(Color.WHITE);
button_2.setFont(new
Font("Tahoma", Font.BOLD, 25));
button_2.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
String
EnterNumbe=textArea_1.getText() + button_2.getText();
textArea_1.setText(EnterNumbe);
}
});
button_2.setBounds(209,
123, 61, 42);
frame.getContentPane().add(button_2);
JButton
btnNewButton_3 = new JButton("7");
btnNewButton_3.setForeground(Color.WHITE);
btnNewButton_3.setBackground(Color.DARK_GRAY);
btnNewButton_3.setFont(new
Font("Tahoma", Font.BOLD, 25));
btnNewButton_3.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
String
EnterNumbe=textArea_1.getText() + btnNewButton_3.getText();
textArea_1.setText(EnterNumbe);
}
});
btnNewButton_3.setBounds(12,
182, 61, 42);
frame.getContentPane().add(btnNewButton_3);
JButton
btnNewButton_4 = new JButton("8");
btnNewButton_4.setForeground(Color.WHITE);
btnNewButton_4.setBackground(Color.DARK_GRAY);
btnNewButton_4.setFont(new
Font("Tahoma", Font.BOLD, 25));
btnNewButton_4.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
String
EnterNumbe=textArea_1.getText() + btnNewButton_4.getText();
textArea_1.setText(EnterNumbe);
}
});
btnNewButton_4.setBounds(110,
182, 61, 42);
frame.getContentPane().add(btnNewButton_4);
JButton
btnNewButton_5 = new JButton("9");
btnNewButton_5.setForeground(Color.WHITE);
btnNewButton_5.setBackground(Color.DARK_GRAY);
btnNewButton_5.setFont(new
Font("Tahoma", Font.BOLD, 25));
btnNewButton_5.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
String
EnterNumbe=textArea_1.getText() + btnNewButton_5.getText();
textArea_1.setText(EnterNumbe);
}
});
btnNewButton_5.setBounds(209,
178, 61, 42);
frame.getContentPane().add(btnNewButton_5);
JButton
btnNewButton_6 = new JButton("*");
btnNewButton_6.setForeground(Color.WHITE);
btnNewButton_6.setBackground(Color.DARK_GRAY);
btnNewButton_6.setFont(new
Font("Tahoma", Font.BOLD, 25));
btnNewButton_6.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
String
EnterNumbe=textArea_1.getText() + btnNewButton_6.getText();
textArea_1.setText(EnterNumbe);
}
});
btnNewButton_6.setBounds(12,
237, 61, 42);
frame.getContentPane().add(btnNewButton_6);
JButton
btnNewButton_7 = new JButton("0");
btnNewButton_7.setForeground(Color.WHITE);
btnNewButton_7.setBackground(Color.DARK_GRAY);
btnNewButton_7.setFont(new
Font("Tahoma", Font.BOLD, 25));
btnNewButton_7.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
String
EnterNumbe=textArea_1.getText() + btnNewButton_7.getText();
textArea_1.setText(EnterNumbe);
}
});
btnNewButton_7.setBounds(110,
237, 61, 42);
frame.getContentPane().add(btnNewButton_7);
JButton
btnNewButton_8 = new JButton("#");
btnNewButton_8.setForeground(Color.WHITE);
btnNewButton_8.setBackground(Color.DARK_GRAY);
btnNewButton_8.setFont(new
Font("Tahoma", Font.BOLD, 25));
btnNewButton_8.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
String
EnterNumbe=textArea_1.getText() + btnNewButton_8.getText();
textArea_1.setText(EnterNumbe);
}
});
btnNewButton_8.setBounds(209,
233, 61, 42);
frame.getContentPane().add(btnNewButton_8);
JButton
btnNewButton_9 = new JButton("Call");
btnNewButton_9.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent arg0) {
Cli2
Y=new Cli2();
try
{
Cli2.D();
}
catch (IOException e) {
//
TODO Auto-generated catch block
e.printStackTrace();
}
}
});
btnNewButton_9.setBackground(Color.GREEN);
btnNewButton_9.setFont(new
Font("Tahoma", Font.BOLD, 28));
btnNewButton_9.setBounds(12,
302, 99, 47);
frame.getContentPane().add(btnNewButton_9);
JButton
btnNewButton_10 = new JButton("Dec");
btnNewButton_10.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
Cli3 Z= new Cli3();
try {
Cli3.E();
}
catch (IOException e1) {
//
TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
btnNewButton_10.setBackground(Color.RED);
btnNewButton_10.setFont(new
Font("Tahoma", Font.BOLD, 28));
btnNewButton_10.setBounds(171,
302, 99, 47);
frame.getContentPane().add(btnNewButton_10);
JButton
btnNewButton_11 = new JButton("<");
btnNewButton_11.setForeground(Color.WHITE);
btnNewButton_11.setBackground(Color.GRAY);
btnNewButton_11.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
Crime_Control.main(new
String[0]);
}
});
btnNewButton_11.setFont(new
Font("Tahoma", Font.BOLD | Font.ITALIC, 24));
btnNewButton_11.setBounds(12,
378, 61, 41);
frame.getContentPane().add(btnNewButton_11);
}
}
Secondpage.java
package Crime_Control;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Font;
import java.awt.Color;
public class secondpage extends JFrame {
private
JPanel contentPane;
private
JTextField txtTerroist;
/**
* Launch the application.
*/
public
static void Newscreen() {
EventQueue.invokeLater(new
Runnable() {
public
void run() {
try
{
secondpage
frame = new secondpage();
frame.setVisible(true);
}
catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public
secondpage() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100,
100, 300, 479);
contentPane
= new JPanel();
contentPane.setBorder(new
EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
txtTerroist
= new JTextField();
txtTerroist.setForeground(Color.WHITE);
txtTerroist.setBackground(Color.BLACK);
txtTerroist.setFont(new
Font("Tahoma", Font.BOLD | Font.ITALIC, 24));
txtTerroist.setText("
Crime Information");
txtTerroist.setBounds(12,
13, 258, 38);
contentPane.add(txtTerroist);
txtTerroist.setColumns(10);
JButton
btnCyberCrime = new JButton("Terrorism");
btnCyberCrime.setForeground(Color.WHITE);
btnCyberCrime.setBackground(Color.BLUE);
btnCyberCrime.setFont(new
Font("Tahoma", Font.BOLD | Font.ITALIC, 25));
btnCyberCrime.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
thirdpage
A=new thirdpage();
A.Newscreen1();
}
});
btnCyberCrime.setBounds(57,
76, 161, 37);
contentPane.add(btnCyberCrime);
JButton
btnRobbery = new JButton("Robbery");
btnRobbery.setFont(new
Font("Tahoma", Font.BOLD | Font.ITALIC, 25));
btnRobbery.setForeground(Color.WHITE);
btnRobbery.setBackground(Color.BLUE);
btnRobbery.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent arg0) {
thirdpage
A=new thirdpage();
A.Newscreen1();
}
});
btnRobbery.setBounds(57,
177, 161, 37);
contentPane.add(btnRobbery);
JButton
btnKidnap = new JButton("Kidnap");
btnKidnap.setFont(new
Font("Tahoma", Font.BOLD | Font.ITALIC, 25));
btnKidnap.setForeground(Color.WHITE);
btnKidnap.setBackground(Color.BLUE);
btnKidnap.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent arg0) {
thirdpage
A=new thirdpage();
A.Newscreen1();
}
});
btnKidnap.setBounds(57,
227, 161, 37);
contentPane.add(btnKidnap);
JButton
btnMurder = new JButton("Murder");
btnMurder.setForeground(Color.WHITE);
btnMurder.setBackground(Color.BLUE);
btnMurder.setFont(new
Font("Tahoma", Font.BOLD | Font.ITALIC, 25));
btnMurder.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent arg0) {
thirdpage
A=new thirdpage();
A.Newscreen1();
}
});
btnMurder.setBounds(57,
126, 161, 38);
contentPane.add(btnMurder);
JButton
btnNewButton = new JButton("Drug");
btnNewButton.setFont(new
Font("Tahoma", Font.BOLD | Font.ITALIC, 25));
btnNewButton.setForeground(Color.WHITE);
btnNewButton.setBackground(Color.BLUE);
btnNewButton.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
thirdpage
A=new thirdpage();
A.Newscreen1();
}
});
btnNewButton.setBounds(57,
277, 161, 37);
contentPane.add(btnNewButton);
JButton
btnNewButton_1 = new JButton("Teasing");
btnNewButton_1.setFont(new
Font("Tahoma", Font.BOLD | Font.ITALIC, 25));
btnNewButton_1.setForeground(Color.WHITE);
btnNewButton_1.setBackground(Color.BLUE);
btnNewButton_1.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
thirdpage
A=new thirdpage();
A.Newscreen1();
}
});
btnNewButton_1.setBounds(57,
327, 161, 37);
contentPane.add(btnNewButton_1);
JButton
btnNewButton_2 = new JButton("Others");
btnNewButton_2.setFont(new
Font("Tahoma", Font.BOLD | Font.ITALIC, 25));
btnNewButton_2.setForeground(Color.WHITE);
btnNewButton_2.setBackground(Color.BLUE);
btnNewButton_2.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
thirdpage A=new thirdpage();
A.Newscreen1();
}
});
btnNewButton_2.setBounds(57,
377, 161, 37);
contentPane.add(btnNewButton_2);
}
}
Thirdpage.java
package Crime_Control;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Image;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import
javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.AbstractButton;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;
import java.awt.Color;
import java.awt.Font;
import javax.swing.SwingConstants;
public class thirdpage extends JFrame {
private
JPanel contentPane;
private
JTextField txtTextUs;
private
JLabel lblNewLabel;
/**
* Launch the application.
*/
public
static void Newscreen1() {
EventQueue.invokeLater(new
Runnable() {
public
void run() {
try
{
thirdpage
frame = new thirdpage();
frame.setVisible(true);
}
catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public
thirdpage() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100,
100, 300, 479);
contentPane
= new JPanel();
contentPane.setBorder(new
EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JButton
btnNewButton = new JButton("Next");
btnNewButton.setForeground(Color.WHITE);
btnNewButton.setBackground(Color.BLUE);
btnNewButton.setFont(new
Font("Tahoma", Font.BOLD | Font.ITALIC, 20));
btnNewButton.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
fourthpage
B=new fourthpage();
B.NewScreen2();
}
});
btnNewButton.setBounds(98,
378, 81, 41);
contentPane.add(btnNewButton);
JButton
btnUploadPhoto = new JButton("Upload Photo");
btnUploadPhoto.setHorizontalAlignment(SwingConstants.LEFT);
btnUploadPhoto.setBackground(Color.BLUE);
btnUploadPhoto.setForeground(Color.WHITE);
btnUploadPhoto.setFont(new
Font("Tahoma", Font.BOLD | Font.ITALIC, 19));
btnUploadPhoto.addActionListener(new
ActionListener() {
public
ImageIcon ResizeImage(String ImagePath) {
ImageIcon
MyImage=new ImageIcon(ImagePath);
Image
img=MyImage.getImage();
Image
newImg=img.getScaledInstance(lblNewLabel.getWidth(), lblNewLabel.getHeight(),
Image.SCALE_SMOOTH);
ImageIcon
image=new ImageIcon(newImg);
return
image;
}
public
void actionPerformed(ActionEvent e) {
JFileChooser
file=new JFileChooser();
file.setCurrentDirectory(new
File(System.getProperty("user.name")));
FileNameExtensionFilter
filter=new
FileNameExtensionFilter("*.Images","jpg","gif","png");
file.addChoosableFileFilter(filter);
int
result=file.showSaveDialog(null);
if(result==JFileChooser.APPROVE_OPTION)
{
File
selectedFile= file.getSelectedFile();
String
path= selectedFile.getAbsolutePath();
lblNewLabel.setIcon(ResizeImage(path));
}
else
if(result==JFileChooser.CANCEL_OPTION) {
System.out.println("No
File Selected");
}
}
});
btnUploadPhoto.setBounds(50,
232, 175, 38);
contentPane.add(btnUploadPhoto);
txtTextUs
= new JTextField();
txtTextUs.setFont(new
Font("Tahoma", Font.PLAIN, 20));
txtTextUs.setText("Text
Us Information");
txtTextUs.setBounds(12,
283, 257, 66);
contentPane.add(txtTextUs);
txtTextUs.setColumns(10);
lblNewLabel
= new JLabel("");
lblNewLabel.setBackground(Color.DARK_GRAY);
lblNewLabel.setForeground(Color.CYAN);
lblNewLabel.setBounds(12,
13, 257, 195);
contentPane.add(lblNewLabel);
}
}
Fourthpage.java
package Crime_Control;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.Font;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
import java.util.Scanner;
import java.awt.event.ActionEvent;
import javax.swing.JTextArea;
public class fourthpage extends JFrame {
private
JPanel contentPane;
private
JTextField txtTextUs;
/**
* Launch the application.
*/
public
static void NewScreen2() {
EventQueue.invokeLater(new
Runnable() {
public
void run() {
try
{
fourthpage
frame = new fourthpage();
frame.setVisible(true);
}
catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public
fourthpage() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100,
100, 300, 479);
contentPane
= new JPanel();
contentPane.setBorder(new
EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
txtTextUs
= new JTextField();
txtTextUs.setFont(new
Font("Tahoma", Font.PLAIN, 18));
txtTextUs.setText("Text
Us Your Location");
txtTextUs.setBounds(12,
122, 258, 139);
contentPane.add(txtTextUs);
txtTextUs.setColumns(10);
JButton
btnNewButton = new JButton("Back");
btnNewButton.setFont(new
Font("Tahoma", Font.PLAIN, 25));
btnNewButton.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent e) {
Crime_Control.main(new
String[0]);
}
});
btnNewButton.setBackground(Color.RED);
btnNewButton.setForeground(Color.WHITE);
btnNewButton.setBounds(12,
311, 104, 51);
contentPane.add(btnNewButton);
JButton
btnNewButton_1 = new JButton("Send");
btnNewButton_1.addActionListener(new
ActionListener() {
public
void actionPerformed(ActionEvent arg0) {
Cli
A= new Cli();
try
{
Cli.B();
}
catch (IOException e) {
//
TODO Auto-generated catch block
e.printStackTrace();
}
}
});
btnNewButton_1.setFont(new
Font("Tahoma", Font.PLAIN, 25));
btnNewButton_1.setBackground(Color.GREEN);
btnNewButton_1.setForeground(Color.WHITE);
btnNewButton_1.setBounds(166,
311, 104, 51);
contentPane.add(btnNewButton_1);
JTextArea
txtrLocationInfo = new JTextArea();
txtrLocationInfo.setFont(new
Font("Monospaced", Font.BOLD | Font.ITALIC, 28));
txtrLocationInfo.setForeground(Color.WHITE);
txtrLocationInfo.setBackground(Color.BLUE);
txtrLocationInfo.setText("
Location info");
txtrLocationInfo.setBounds(12,
34, 258, 43);
contentPane.add(txtrLocationInfo);
}
}
Fifthpage.java
package Crime_Control;
import java.awt.Desktop;
import java.net.URI;
public class Fifthpage {
public
static void New() throws Exception {
//
TODO Auto-generated method stub
Desktop
d=Desktop.getDesktop();
d.browse(new
URI("http://www.google.com/maps/dir/?api=1¶meters"));
}
}
Ser.java
package Crime_Control;
import java.io.IOException;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
public class Ser {
public
static void main(String[]args) throws IOException {
ServerSocket
s1=new ServerSocket(1234);
Socket
ss=s1.accept();
Scanner
sc=new Scanner(ss.getInputStream());
String
temp="Message received and thanks for your cooperation.";
PrintStream
p=new PrintStream(ss.getOutputStream());
p.println(temp);
}
}
Cli.java
package Crime_Control;
import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;
public class Cli {
public
static void B() throws UnknownHostException, IOException {
Socket
s=new Socket("127.0.0.1",1234);
Scanner
sc1=new Scanner(s.getInputStream());
PrintStream
p= new PrintStream(s.getOutputStream());
String
temp=sc1.nextLine();
System.out.println(temp);
}
}
Ser1.java
package Crime_Control;
import java.io.IOException;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
public class Ser1 {
public
static void main(String[] args) throws IOException {
ServerSocket
s1=new ServerSocket(5678);
Socket
ss=s1.accept();
Scanner
sc=new Scanner(ss.getInputStream());
String
temp="Location traced and locked.";
PrintStream
p=new PrintStream(ss.getOutputStream());
p.println(temp);
}
}
Cli1.java
package Crime_Control;
import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;
public class Cli1 {
public
static void C() throws UnknownHostException, IOException {
Socket s=new Socket("127.0.0.1",5678);
Scanner
sc1=new Scanner(s.getInputStream());
PrintStream
p= new PrintStream(s.getOutputStream());
String
temp=sc1.nextLine();
System.out.println(temp);
}
}
Ser2.java
package Crime_Control;
import java.io.IOException;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
public class Ser2 {
public
static void main(String[] args) throws IOException {
ServerSocket
s1=new ServerSocket(4321);
Socket
ss=s1.accept();
Scanner
sc=new Scanner(ss.getInputStream());
String
temp="Please wait for picking up the call.";
PrintStream
p=new PrintStream(ss.getOutputStream());
p.println(temp);
}
}
Cli2.java
package Crime_Control;
import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;
public class Cli2 {
public
static void D() throws UnknownHostException, IOException {
Socket s=new
Socket("127.0.0.1",4321);
Scanner sc1=new Scanner(s.getInputStream());
PrintStream p= new
PrintStream(s.getOutputStream());
String temp=sc1.nextLine();
System.out.println(temp);
}
}
Ser3.java
package Crime_Control;
import java.io.IOException;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;
public class Ser3 {
public
static void main(String[] args) throws IOException {
ServerSocket
s1=new ServerSocket(8765);
Socket
ss=s1.accept();
Scanner
sc=new Scanner(ss.getInputStream());
String
temp="Declined the call from server.";
PrintStream
p=new PrintStream(ss.getOutputStream());
p.println(temp);
}
}
Cli3.java
package Crime_Control;
import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;
public class Cli3 {
public
static void E() throws UnknownHostException, IOException {
Socket s=new
Socket("127.0.0.1",8765);
Scanner sc1=new Scanner(s.getInputStream());
PrintStream p= new
PrintStream(s.getOutputStream());
String temp=sc1.nextLine();
System.out.println(temp);
}
}
Post a Comment