front_processing/extern/TUIO_JAVA/src/TuioApplet.java
changeset 0 6fefd4afe506
child 9 0f44b7360c8d
equal deleted inserted replaced
-1:000000000000 0:6fefd4afe506
       
     1 /*
       
     2 	 TUIO Java Demo - part of the reacTIVision project
       
     3 	 http://reactivision.sourceforge.net/
       
     4 	 
       
     5 	 Copyright (c) 2005-2009 Martin Kaltenbrunner <mkalten@iua.upf.edu>
       
     6 	 
       
     7 	 This program is free software; you can redistribute it and/or modify
       
     8 	 it under the terms of the GNU General Public License as published by
       
     9 	 the Free Software Foundation; either version 2 of the License, or
       
    10 	 (at your option) any later version.
       
    11 	 
       
    12 	 This program is distributed in the hope that it will be useful,
       
    13 	 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14 	 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
       
    15 	 GNU General Public License for more details.
       
    16 	 
       
    17 	 You should have received a copy of the GNU General Public License
       
    18 	 along with this program; if not, write to the Free Software
       
    19 	 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
       
    20 */
       
    21 
       
    22 import java.applet.*;
       
    23 import java.awt.*;
       
    24 import javax.swing.*;
       
    25 import java.io.*;
       
    26 import java.net.*;
       
    27 import TUIO.*;
       
    28 
       
    29 public class TuioApplet extends JApplet {
       
    30 	
       
    31 	TuioDemoComponent demo;
       
    32 	TuioClient client;
       
    33 	int port = 3333;
       
    34 	
       
    35 	public void init() {
       
    36 		try {
       
    37 			port = Integer.parseInt(getParameter("port"));
       
    38 		} catch (Exception e) {}
       
    39 		
       
    40 		Dimension size = this.getSize();
       
    41 		
       
    42 		TuioDemoComponent demo = new TuioDemoComponent();
       
    43 		demo.setSize(size.width,size.height);
       
    44 	
       
    45 		client = new TuioClient();
       
    46 		client.addTuioListener(demo);
       
    47 		
       
    48 		add(demo);
       
    49 		repaint();
       
    50 	}
       
    51 
       
    52 	public void start() {
       
    53 		if (!client.isConnected()) client.connect();
       
    54 	}
       
    55 
       
    56 	public void stop() {
       
    57 		if (client.isConnected()) client.disconnect();
       
    58 	}
       
    59 
       
    60 	public void destroy() {
       
    61 		if (client.isConnected()) client.disconnect();
       
    62 		client = null;
       
    63 	}
       
    64 
       
    65 	public void paint( Graphics g ) {
       
    66 	}
       
    67 }