LAMPIRAN A:
Source Code
Aplikasi
Client
public static void main (String[] args){ try {
UIManager.setLookAndFeel(UIManager. getSystemLookAndFeelClassName());
System.loadLibrary(Core.NATIVE_LIBRARY_NAME); JFrame frame = new JFrame("
Sistem Pendeteksian Manusia – Jonatan Sianturi"); frame.setDefaultCloseOperation
(JFrame.EXIT_ON_CLOSE); frame.setSize(1340, 630);
Dimension screen = Toolkit.getDefaultToolkit() .getScreenSize();
int widthOfScreen = (screen.width – frame.getSize().width)/2;
int heightOfScreen = (screen.height – frame.getSize().height)/2 - 10;
@Override
public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub
int dialogResult =
JOptionPane.showConfirmDialog (null, "Are you sure want to exit?", "Exit",
public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub JOptionPane.showMessageDialog(null, "Copyrigth ©2014 Jonatan Sianturi" , "About",
JOptionPane.INFORMATION_MESSAGE); }
});
menuFile.add(fileExit); menuHelp.add(fileAbout);
TopPanel topPanel = new TopPanel();
webCam.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, 480);
detectPanel.MatToBufferedImage (webcam_image);
detectPanel.repaint();
long end_time = System.nanoTime(); System.out.println(String.format("Time: %.2f ms", (float)(end_time - start_time)/1000000));
} else {
System.out.println("No frame"); break;
} }
} else{
System.out.println("No camera"); }
webCam.release(); }
catch (Exception e) {
// TODO Auto-generated catch block e.printStackTrace();
} }
LAMPIRAN B:
Source Code
Aplikasi
Server
public class Server {
private static ServerSocket serverSocket; private static final int PORT = 1234;
public static void main(String[] args) throws IOException { try {
serverSocket = new ServerSocket(PORT);
System.out.println("Server berjalan, menunggu client...");
class ClientHandler extends Thread {
private Socket client; private Scanner input; private PrintWriter output;
public ClientHandler(Socket socket) {
//Set up referensi ke socket yang beraosiasi...
output.println("Informasi telah diterima server"); System.out.println(received);
Sound sound = new Sound();
sound.play();
try {
if (client != null) { client.close(); }
} catch (IOException ioEx) {
System.out.println("Penutupan koneksi gagal!"); }