/* ==========================================
 * JGraphT : a free Java graph-theory library
 * ==========================================
 *
 * Project Info:  http://jgrapht.sourceforge.net/
 * Project Lead:  Barak Naveh (http://sourceforge.net/users/barak_naveh)
 *
 * (C) Copyright 2003-2006, by Barak Naveh and Contributors.
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
 */
/* -------------------
 * SimpleTouchgraphApplet.java
 * -------------------
 * (C) Copyright 2006, by Carl Anderson and Contributors.
 *
 * Original Author:  Carl Anderson
 * Contributor(s):   -
 *
 * $Id: UniformRandomGraphGenerator.java,v 1.2 2004/10/13 08:09:59 behrisch Exp
 * $
 *
 * Changes
 * -------
 * 8-May-2006 : Initial revision (CA);
 *
 */
package org.jgrapht.experimental.touchgraph;

import java.applet.Applet;
import java.awt.BorderLayout;

import javax.swing.*;

import org.jgrapht.Edge;
import org.jgrapht.Graph;
import org.jgrapht.UndirectedGraph;
import org.jgrapht.graph.SimpleGraph;

/**
 * SimpleTouchgraphApplet 
 *
 * @author canderson
 */
public class SimpleTouchgraphApplet extends Applet
{
    /**
     * 
     */
    private static final long serialVersionUID = 6213379835360007840L;

    /**
     * create a graph: code taken from non-visible org._3pq.jgrapht.demo.createStringGraph()
     * */
    public Graph createSamplegraph()
    {
        UndirectedGraph<String,Edge<String>> g = new SimpleGraph<String,Edge<String>>();

        String v1 = "v1";
        String v2 = "v2";
        String v3 = "v3";
        String v4 = "v4";

        // add the vertices
        g.addVertex(v1);
        g.addVertex(v2);
        g.addVertex(v3);
        g.addVertex(v4);

        // add edges to create a circuit
        g.addEdge(v1, v2);
        g.addEdge(v2, v3);
        g.addEdge(v3, v4);
        g.addEdge(v4, v1);

        return g;
    }
    
    /**
     * initialize the applet
     */
    public void init()
    {
        Graph g = createSamplegraph();
        boolean selfReferencesAllowed = false;
        
        setLayout(new BorderLayout());
        setSize(800,600);
        add(new TouchgraphPanel(g,selfReferencesAllowed), BorderLayout.CENTER);
    }
    
    public static void main(String [] args)
    {
        SimpleTouchgraphApplet applet = new SimpleTouchgraphApplet();
        
        applet.init();
        JFrame frame = new JFrame();
        frame.getContentPane().add(applet);
        frame.setTitle("JGraphT to Touchgraph Converter Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
        try {
            Thread.currentThread().sleep(5000000);
        } catch (InterruptedException ex) {
        }
    }
}

// End SimpleTouchgraphApplet.java

@@ -1510,28 +1510,17 @@
 ava.awt.
-BorderLayout
+*
 ;%0A%0Aimpor
@@ -1993,16 +1993,23 @@
  public 
+static 
 Graph cr
@@ -2922,101 +2922,86 @@
     
-SimpleTouchgraphApplet applet = new SimpleTouchgraphApplet();%0A        %0A        applet.init();
+Graph g = createSamplegraph();%0A        boolean selfReferencesAllowed = false;%0A
 %0A   
@@ -3023,16 +3023,28 @@
 me = new
+%0A           
  JFrame(
@@ -3081,22 +3081,129 @@
 e().add(
-applet
+%0A            new TouchgraphPanel(g,selfReferencesAllowed));%0A        frame.setPreferredSize(new Dimension(800,800)
 );%0A     
@@ -3258,16 +3258,29 @@
 er Demo%22
+%0A            
 );%0A     

Fix resize in SimpleTouchgraphApplet.