front_processing/extern/TUIO_JAVA/src/TuioApplet.java
author bastiena
Wed, 30 May 2012 10:21:36 +0200
changeset 35 4267d6d27a7d
parent 28 9ccef81f02ab
permissions -rw-r--r--
Front IDILL : Config file added dor the Front Random play at the beginning (when no user is detected) Pointers added Curves added (search and filter modes) Mosaic completion added (depletion to come later) State of the Front : just before the communication module creation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
     1
/*
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
     2
     TUIO Java Demo - part of the reacTIVision project
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
     3
     http://reactivision.sourceforge.net/
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
     4
     
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
     5
     Copyright (c) 2005-2009 Martin Kaltenbrunner <mkalten@iua.upf.edu>
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
     6
     
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
     7
     This program is free software; you can redistribute it and/or modify
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
     8
     it under the terms of the GNU General Public License as published by
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
     9
     the Free Software Foundation; either version 2 of the License, or
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    10
     (at your option) any later version.
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    11
     
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    12
     This program is distributed in the hope that it will be useful,
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    13
     but WITHOUT ANY WARRANTY; without even the implied warranty of
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    14
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    15
     GNU General Public License for more details.
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    16
     
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    17
     You should have received a copy of the GNU General Public License
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    18
     along with this program; if not, write to the Free Software
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    19
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    20
*/
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    21
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    22
import java.applet.*;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    23
import java.awt.*;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    24
import javax.swing.*;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    25
import java.io.*;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    26
import java.net.*;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    27
import TUIO.*;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    29
public class TuioApplet extends JApplet {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    30
    
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    31
    TuioDemoComponent demo;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    32
    TuioClient client;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    33
    int port = 3333;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    34
    
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    35
    public void init() {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    36
        try {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    37
            port = Integer.parseInt(getParameter("port"));
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    38
        } catch (Exception e) {}
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    39
        
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    40
        Dimension size = this.getSize();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    41
        
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    42
        TuioDemoComponent demo = new TuioDemoComponent();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    43
        demo.setSize(size.width,size.height);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    44
    
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    45
        client = new TuioClient();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    46
        client.addTuioListener(demo);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    47
        
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    48
        add(demo);
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    49
        repaint();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    50
    }
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    51
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    52
    public void start() {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    53
        if (!client.isConnected()) client.connect();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    54
    }
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    55
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    56
    public void stop() {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    57
        if (client.isConnected()) client.disconnect();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    58
    }
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    59
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    60
    public void destroy() {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    61
        if (client.isConnected()) client.disconnect();
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    62
        client = null;
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    63
    }
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    64
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    65
    public void paint( Graphics g ) {
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    66
    }
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 10
diff changeset
    67
}